本文整理汇总了Java中org.apache.cassandra.config.DatabaseDescriptor.getRoleManager方法的典型用法代码示例。如果您正苦于以下问题:Java DatabaseDescriptor.getRoleManager方法的具体用法?Java DatabaseDescriptor.getRoleManager怎么用?Java DatabaseDescriptor.getRoleManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cassandra.config.DatabaseDescriptor
的用法示例。
在下文中一共展示了DatabaseDescriptor.getRoleManager方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: formatResults
import org.apache.cassandra.config.DatabaseDescriptor; //导入方法依赖的package包/类
protected ResultMessage formatResults(List<RoleResource> sortedRoles)
{
ResultSet result = new ResultSet(metadata);
IRoleManager roleManager = DatabaseDescriptor.getRoleManager();
for (RoleResource role : sortedRoles)
{
result.addColumnValue(UTF8Type.instance.decompose(role.getRoleName()));
result.addColumnValue(BooleanType.instance.decompose(roleManager.isSuper(role)));
result.addColumnValue(BooleanType.instance.decompose(roleManager.canLogin(role)));
result.addColumnValue(optionsType.decompose(roleManager.getCustomOptions(role)));
}
return new ResultMessage.Rows(result);
}
示例2: formatResults
import org.apache.cassandra.config.DatabaseDescriptor; //导入方法依赖的package包/类
@Override
protected ResultMessage formatResults(List<RoleResource> sortedRoles)
{
ResultSet result = new ResultSet(metadata);
IRoleManager roleManager = DatabaseDescriptor.getRoleManager();
for (RoleResource role : sortedRoles)
{
if (!roleManager.canLogin(role))
continue;
result.addColumnValue(UTF8Type.instance.decompose(role.getRoleName()));
result.addColumnValue(BooleanType.instance.decompose(Roles.hasSuperuserStatus(role)));
}
return new ResultMessage.Rows(result);
}
示例3: hasSuperuserStatus
import org.apache.cassandra.config.DatabaseDescriptor; //导入方法依赖的package包/类
/**
* Returns true if the supplied role or any other role granted to it
* (directly or indirectly) has superuser status.
*
* @param role the primary role
* @return true if the role has superuser status, false otherwise
*/
public static boolean hasSuperuserStatus(RoleResource role)
{
IRoleManager roleManager = DatabaseDescriptor.getRoleManager();
for (RoleResource r : cache.getRoles(role))
if (roleManager.isSuper(r))
return true;
return false;
}