本文整理汇总了Java中org.apache.cassandra.service.ClientState.ensureHasPermission方法的典型用法代码示例。如果您正苦于以下问题:Java ClientState.ensureHasPermission方法的具体用法?Java ClientState.ensureHasPermission怎么用?Java ClientState.ensureHasPermission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cassandra.service.ClientState
的用法示例。
在下文中一共展示了ClientState.ensureHasPermission方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkAccess
import org.apache.cassandra.service.ClientState; //导入方法依赖的package包/类
public void checkAccess(ClientState state) throws InvalidRequestException, UnauthorizedException
{
state.hasColumnFamilyAccess(keyspace(), columnFamily(), Permission.MODIFY);
// CAS updates can be used to simulate a SELECT query, so should require Permission.SELECT as well.
if (hasConditions())
state.hasColumnFamilyAccess(keyspace(), columnFamily(), Permission.SELECT);
// MV updates need to get the current state from the table, and might update the views
// Require Permission.SELECT on the base table, and Permission.MODIFY on the views
Iterator<ViewDefinition> views = View.findAll(keyspace(), columnFamily()).iterator();
if (views.hasNext())
{
state.hasColumnFamilyAccess(keyspace(), columnFamily(), Permission.SELECT);
do
{
state.hasColumnFamilyAccess(keyspace(), views.next().viewName, Permission.MODIFY);
} while (views.hasNext());
}
for (Function function : getFunctions())
state.ensureHasPermission(Permission.EXECUTE, function);
}
示例2: checkAccess
import org.apache.cassandra.service.ClientState; //导入方法依赖的package包/类
public void checkAccess(ClientState state) throws UnauthorizedException, InvalidRequestException
{
Function function = findFunction();
if (function == null)
{
if (!ifExists)
throw new InvalidRequestException(String.format("Unconfigured function %s.%s(%s)",
functionName.keyspace,
functionName.name,
Joiner.on(",").join(argRawTypes)));
}
else
{
state.ensureHasPermission(Permission.DROP, FunctionResource.function(function.name().keyspace,
function.name().name,
function.argTypes()));
}
}
示例3: checkAccess
import org.apache.cassandra.service.ClientState; //导入方法依赖的package包/类
public void checkAccess(ClientState state) throws InvalidRequestException, UnauthorizedException
{
if (cfm.isView())
{
CFMetaData baseTable = View.findBaseTable(keyspace(), columnFamily());
if (baseTable != null)
state.hasColumnFamilyAccess(keyspace(), baseTable.cfName, Permission.SELECT);
}
else
{
state.hasColumnFamilyAccess(keyspace(), columnFamily(), Permission.SELECT);
}
for (Function function : getFunctions())
state.ensureHasPermission(Permission.EXECUTE, function);
}
示例4: checkAccess
import org.apache.cassandra.service.ClientState; //导入方法依赖的package包/类
public void checkAccess(ClientState state) throws UnauthorizedException
{
// check that the user has AUTHORIZE permission on the resource or its parents, otherwise reject GRANT/REVOKE.
state.ensureHasPermission(Permission.AUTHORIZE, resource);
// check that the user has [a single permission or all in case of ALL] on the resource or its parents.
for (Permission p : permissions)
state.ensureHasPermission(p, resource);
}
示例5: checkAccess
import org.apache.cassandra.service.ClientState; //导入方法依赖的package包/类
public void checkAccess(ClientState state) throws UnauthorizedException, InvalidRequestException
{
if (Schema.instance.findFunction(functionName, argTypes).isPresent() && orReplace)
state.ensureHasPermission(Permission.ALTER, FunctionResource.function(functionName.keyspace,
functionName.name,
argTypes));
else
state.ensureHasPermission(Permission.CREATE, FunctionResource.keyspace(functionName.keyspace));
state.ensureHasPermission(Permission.EXECUTE, stateFunction);
if (finalFunction != null)
state.ensureHasPermission(Permission.EXECUTE, finalFunction);
}
示例6: checkPermission
import org.apache.cassandra.service.ClientState; //导入方法依赖的package包/类
public void checkPermission(ClientState state, Permission required, RoleResource resource) throws UnauthorizedException
{
try
{
state.ensureHasPermission(required, resource);
}
catch (UnauthorizedException e)
{
// Catch and rethrow with a more friendly message
throw new UnauthorizedException(String.format("User %s does not have sufficient privileges " +
"to perform the requested operation",
state.getUser().getName()));
}
}
示例7: checkAccess
import org.apache.cassandra.service.ClientState; //导入方法依赖的package包/类
public void checkAccess(ClientState state) throws UnauthorizedException, InvalidRequestException
{
if (Schema.instance.findFunction(functionName, argTypes).isPresent() && orReplace)
state.ensureHasPermission(Permission.ALTER, FunctionResource.function(functionName.keyspace,
functionName.name,
argTypes));
else
state.ensureHasPermission(Permission.CREATE, FunctionResource.keyspace(functionName.keyspace));
}