当前位置: 首页>>代码示例>>Java>>正文


Java ClientState.ensureHasPermission方法代码示例

本文整理汇总了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);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:24,代码来源:ModificationStatement.java

示例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()));
    }
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:19,代码来源:DropFunctionStatement.java

示例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);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:17,代码来源:SelectStatement.java

示例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);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:9,代码来源:PermissionAlteringStatement.java

示例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);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:15,代码来源:CreateAggregateStatement.java

示例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()));
    }
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:15,代码来源:AuthenticationStatement.java

示例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));
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:10,代码来源:CreateFunctionStatement.java


注:本文中的org.apache.cassandra.service.ClientState.ensureHasPermission方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。