本文整理汇总了Java中org.apache.cassandra.auth.Permission类的典型用法代码示例。如果您正苦于以下问题:Java Permission类的具体用法?Java Permission怎么用?Java Permission使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Permission类属于org.apache.cassandra.auth包,在下文中一共展示了Permission类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: system_add_column_family
import org.apache.cassandra.auth.Permission; //导入依赖的package包/类
public String system_add_column_family(CfDef cf_def)
throws InvalidRequestException, SchemaDisagreementException, TException
{
logger.debug("add_column_family");
try
{
ClientState cState = state();
String keyspace = cState.getKeyspace();
cState.hasKeyspaceAccess(keyspace, Permission.CREATE);
cf_def.unsetId(); // explicitly ignore any id set by client (Hector likes to set zero)
CFMetaData cfm = CFMetaData.fromThrift(cf_def);
CFMetaData.validateCompactionOptions(cfm.compactionStrategyClass, cfm.compactionStrategyOptions);
cfm.addDefaultIndexNames();
if (!cfm.getTriggers().isEmpty())
state().ensureIsSuper("Only superusers are allowed to add triggers.");
MigrationManager.announceNewColumnFamily(cfm);
return Schema.instance.getVersion().toString();
}
catch (RequestValidationException e)
{
throw ThriftConversion.toThrift(e);
}
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:27,代码来源:CassandraServer.java
示例2: system_drop_column_family
import org.apache.cassandra.auth.Permission; //导入依赖的package包/类
public String system_drop_column_family(String column_family)
throws InvalidRequestException, SchemaDisagreementException, TException
{
logger.debug("drop_column_family");
ThriftClientState cState = state();
try
{
String keyspace = cState.getKeyspace();
cState.hasColumnFamilyAccess(keyspace, column_family, Permission.DROP);
MigrationManager.announceColumnFamilyDrop(keyspace, column_family);
return Schema.instance.getVersion().toString();
}
catch (RequestValidationException e)
{
throw ThriftConversion.toThrift(e);
}
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:20,代码来源:CassandraServer.java
示例3: system_drop_keyspace
import org.apache.cassandra.auth.Permission; //导入依赖的package包/类
public String system_drop_keyspace(String keyspace)
throws InvalidRequestException, SchemaDisagreementException, TException
{
logger.debug("drop_keyspace");
try
{
ThriftValidation.validateKeyspaceNotSystem(keyspace);
state().hasKeyspaceAccess(keyspace, Permission.DROP);
MigrationManager.announceKeyspaceDrop(keyspace);
return Schema.instance.getVersion().toString();
}
catch (RequestValidationException e)
{
throw ThriftConversion.toThrift(e);
}
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:19,代码来源:CassandraServer.java
示例4: system_update_keyspace
import org.apache.cassandra.auth.Permission; //导入依赖的package包/类
/** update an existing keyspace, but do not allow column family modifications.
* @throws SchemaDisagreementException
*/
public String system_update_keyspace(KsDef ks_def)
throws InvalidRequestException, SchemaDisagreementException, TException
{
logger.debug("update_keyspace");
try
{
ThriftValidation.validateKeyspaceNotSystem(ks_def.name);
state().hasKeyspaceAccess(ks_def.name, Permission.ALTER);
ThriftValidation.validateKeyspace(ks_def.name);
if (ks_def.getCf_defs() != null && ks_def.getCf_defs().size() > 0)
throw new InvalidRequestException("Keyspace update must not contain any column family definitions.");
MigrationManager.announceKeyspaceUpdate(KSMetaData.fromThrift(ks_def));
return Schema.instance.getVersion().toString();
}
catch (RequestValidationException e)
{
throw ThriftConversion.toThrift(e);
}
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:25,代码来源:CassandraServer.java
示例5: prepareRowMutations
import org.apache.cassandra.auth.Permission; //导入依赖的package包/类
public List<IMutation> prepareRowMutations(String keyspace, ThriftClientState clientState, Long timestamp, List<ByteBuffer> variables)
throws InvalidRequestException, UnauthorizedException
{
CFMetaData metadata = validateColumnFamily(keyspace, columnFamily);
clientState.hasColumnFamilyAccess(keyspace, columnFamily, Permission.MODIFY);
AbstractType<?> keyType = Schema.instance.getCFMetaData(keyspace, columnFamily).getKeyValidator();
List<IMutation> rowMutations = new ArrayList<IMutation>(keys.size());
for (Term key : keys)
{
rowMutations.add(mutationForKey(key.getByteBuffer(keyType, variables), keyspace, timestamp, clientState, variables, metadata));
}
return rowMutations;
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:18,代码来源:DeleteStatement.java
示例6: checkAccess
import org.apache.cassandra.auth.Permission; //导入依赖的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
示例7: checkAccess
import org.apache.cassandra.auth.Permission; //导入依赖的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
示例8: checkAccess
import org.apache.cassandra.auth.Permission; //导入依赖的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
示例9: system_add_column_family
import org.apache.cassandra.auth.Permission; //导入依赖的package包/类
public String system_add_column_family(CfDef cf_def) throws TException
{
logger.trace("add_column_family");
try
{
ClientState cState = state();
String keyspace = cState.getKeyspace();
cState.hasKeyspaceAccess(keyspace, Permission.CREATE);
cf_def.unsetId(); // explicitly ignore any id set by client (Hector likes to set zero)
CFMetaData cfm = ThriftConversion.fromThrift(cf_def);
cfm.params.compaction.validate();
if (!cfm.getTriggers().isEmpty())
state().ensureIsSuper("Only superusers are allowed to add triggers.");
MigrationManager.announceNewColumnFamily(cfm);
return Schema.instance.getVersion().toString();
}
catch (RequestValidationException e)
{
throw ThriftConversion.toThrift(e);
}
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:25,代码来源:CassandraServer.java
示例10: system_drop_column_family
import org.apache.cassandra.auth.Permission; //导入依赖的package包/类
public String system_drop_column_family(String column_family)
throws InvalidRequestException, SchemaDisagreementException, TException
{
logger.trace("drop_column_family");
ThriftClientState cState = state();
try
{
String keyspace = cState.getKeyspace();
cState.hasColumnFamilyAccess(keyspace, column_family, Permission.DROP);
CFMetaData metadata = ThriftValidation.validateColumnFamily(keyspace, column_family);
if (metadata.isView())
throw new org.apache.cassandra.exceptions.InvalidRequestException("Cannot drop Materialized Views from Thrift");
MigrationManager.announceColumnFamilyDrop(keyspace, column_family);
return Schema.instance.getVersion().toString();
}
catch (RequestValidationException e)
{
throw ThriftConversion.toThrift(e);
}
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:25,代码来源:CassandraServer.java
示例11: system_drop_keyspace
import org.apache.cassandra.auth.Permission; //导入依赖的package包/类
public String system_drop_keyspace(String keyspace)
throws InvalidRequestException, SchemaDisagreementException, TException
{
logger.trace("drop_keyspace");
try
{
ThriftValidation.validateKeyspaceNotSystem(keyspace);
state().hasKeyspaceAccess(keyspace, Permission.DROP);
MigrationManager.announceKeyspaceDrop(keyspace);
return Schema.instance.getVersion().toString();
}
catch (RequestValidationException e)
{
throw ThriftConversion.toThrift(e);
}
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:19,代码来源:CassandraServer.java
示例12: system_update_keyspace
import org.apache.cassandra.auth.Permission; //导入依赖的package包/类
/** update an existing keyspace, but do not allow column family modifications.
* @throws SchemaDisagreementException
*/
public String system_update_keyspace(KsDef ks_def)
throws InvalidRequestException, SchemaDisagreementException, TException
{
logger.trace("update_keyspace");
try
{
ThriftValidation.validateKeyspaceNotSystem(ks_def.name);
state().hasKeyspaceAccess(ks_def.name, Permission.ALTER);
ThriftValidation.validateKeyspace(ks_def.name);
if (ks_def.getCf_defs() != null && ks_def.getCf_defs().size() > 0)
throw new InvalidRequestException("Keyspace update must not contain any table definitions.");
MigrationManager.announceKeyspaceUpdate(ThriftConversion.fromThrift(ks_def));
return Schema.instance.getVersion().toString();
}
catch (RequestValidationException e)
{
throw ThriftConversion.toThrift(e);
}
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:25,代码来源:CassandraServer.java
示例13: system_update_keyspace
import org.apache.cassandra.auth.Permission; //导入依赖的package包/类
/** update an existing keyspace, but do not allow column family modifications.
* @throws SchemaDisagreementException
*/
public String system_update_keyspace(KsDef ks_def)
throws InvalidRequestException, SchemaDisagreementException, TException
{
logger.debug("update_keyspace");
try
{
ThriftValidation.validateKeyspaceNotSystem(ks_def.name);
state().hasKeyspaceAccess(ks_def.name, Permission.ALTER);
ThriftValidation.validateKeyspace(ks_def.name);
if (ks_def.getCf_defs() != null && ks_def.getCf_defs().size() > 0)
throw new InvalidRequestException("Keyspace update must not contain any table definitions.");
MigrationManager.announceKeyspaceUpdate(KSMetaData.fromThrift(ks_def));
return Schema.instance.getVersion().toString();
}
catch (RequestValidationException e)
{
throw ThriftConversion.toThrift(e);
}
}
开发者ID:daidong,项目名称:GraphTrek,代码行数:25,代码来源:CassandraServer.java
示例14: system_update_keyspace
import org.apache.cassandra.auth.Permission; //导入依赖的package包/类
/** update an existing keyspace, but do not allow column family modifications.
* @throws SchemaDisagreementException
*/
public String system_update_keyspace(KsDef ks_def)
throws InvalidRequestException, SchemaDisagreementException, TException
{
logger.debug("update_keyspace");
try
{
ThriftValidation.validateKeyspaceNotSystem(ks_def.name);
state().hasKeyspaceAccess(ks_def.name, Permission.ALTER);
//wso2
String keyspace = state().resolveKeyspace(ks_def.name);
ThriftValidation.validateTable(keyspace);
ks_def.setName(keyspace);
if (ks_def.getCf_defs() != null && ks_def.getCf_defs().size() > 0)
throw new InvalidRequestException("Keyspace update must not contain any column family definitions.");
MigrationManager.announceKeyspaceUpdate(KSMetaData.fromThrift(ks_def));
return Schema.instance.getVersion().toString();
}
catch (RequestValidationException e)
{
throw ThriftConversion.toThrift(e);
}
}
开发者ID:wso2,项目名称:wso2-cassandra,代码行数:28,代码来源:CassandraServer.java
示例15: system_drop_column_family
import org.apache.cassandra.auth.Permission; //导入依赖的package包/类
public String system_drop_column_family(String column_family)
throws InvalidRequestException, SchemaDisagreementException, TException
{
logger.debug("drop_column_family");
ThriftClientState cState = state();
try
{
String keyspace = cState.getKeyspace();
cState.hasColumnFamilyAccess(keyspace, column_family, Permission.DROP);
MigrationManager.announceColumnFamilyDrop(keyspace, column_family, state());
return Schema.instance.getVersion().toString();
}
catch (RequestValidationException e)
{
throw ThriftConversion.toThrift(e);
}
}
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:20,代码来源:CassandraServer.java
示例16: system_drop_keyspace
import org.apache.cassandra.auth.Permission; //导入依赖的package包/类
public String system_drop_keyspace(String keyspace)
throws InvalidRequestException, SchemaDisagreementException, TException
{
logger.debug("drop_keyspace");
try
{
ThriftValidation.validateKeyspaceNotSystem(keyspace);
state().hasKeyspaceAccess(keyspace, Permission.DROP);
MigrationManager.announceKeyspaceDrop(keyspace, state());
return Schema.instance.getVersion().toString();
}
catch (RequestValidationException e)
{
throw ThriftConversion.toThrift(e);
}
}
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:19,代码来源:CassandraServer.java
示例17: internal_remove
import org.apache.cassandra.auth.Permission; //导入依赖的package包/类
private void internal_remove(ByteBuffer key, ColumnPath column_path, long timestamp, ConsistencyLevel consistency_level, boolean isCommutativeOp)
throws RequestValidationException, UnavailableException, TimedOutException
{
ThriftClientState cState = state();
//wso2
String keyspace = cState.getResolvedKeyspace();
cState.hasColumnFamilyAccess(keyspace, column_path.column_family, Permission.MODIFY);
CFMetaData metadata = ThriftValidation.validateColumnFamily(keyspace, column_path.column_family, isCommutativeOp);
ThriftValidation.validateKey(metadata, key);
ThriftValidation.validateColumnPathOrParent(metadata, column_path);
if (isCommutativeOp)
ThriftConversion.fromThrift(consistency_level).validateCounterForWrite(metadata);
RowMutation rm = new RowMutation(keyspace, key);
rm.delete(new QueryPath(column_path), timestamp);
if (isCommutativeOp)
doInsert(consistency_level, Arrays.asList(new CounterMutation(rm, ThriftConversion.fromThrift(consistency_level))));
else
doInsert(consistency_level, Arrays.asList(rm));
}
开发者ID:wso2,项目名称:wso2-cassandra,代码行数:23,代码来源:CassandraServer.java
示例18: system_add_column_family
import org.apache.cassandra.auth.Permission; //导入依赖的package包/类
public String system_add_column_family(CfDef cf_def)
throws InvalidRequestException, SchemaDisagreementException, TException
{
logger.debug("add_column_family");
try
{
ClientState cState = state();
String keyspace = cState.getKeyspace();
cState.hasKeyspaceAccess(keyspace, Permission.CREATE);
cf_def.unsetId(); // explicitly ignore any id set by client (Hector likes to set zero)
CFMetaData cfm = CFMetaData.fromThrift(cf_def);
CFMetaData.validateCompactionOptions(cfm.compactionStrategyClass, cfm.compactionStrategyOptions, false);
cfm.addDefaultIndexNames();
MigrationManager.announceNewColumnFamily(cfm);
return Schema.instance.getVersion().toString();
}
catch (RequestValidationException e)
{
throw ThriftConversion.toThrift(e);
}
}
开发者ID:jackliu8722,项目名称:cassandra-1.2.16,代码行数:24,代码来源:CassandraServer.java
示例19: authorize
import org.apache.cassandra.auth.Permission; //导入依赖的package包/类
public Set<Permission> authorize(AuthenticatedUser user, IResource resource) {
String uname, rname;
access.log(Level.DEBUG,"Authorizing",uname=user.getName(),"for",rname=resource.getName());
Set<Permission> permissions;
if(user instanceof AAFAuthenticatedUser) {
AAFAuthenticatedUser aafUser = (AAFAuthenticatedUser) user;
aafUser.setAnonymous(false);
if(aafUser.isLocal()) {
permissions = checkPermissions(aafUser, new LocalPermission(
rname.replaceFirst("data", cluster_name)
));
} else {
permissions = checkPermissions(
aafUser,
perm_type,
':'+rname.replaceFirst("data", cluster_name).replace('/', ':'));
}
} else {
permissions = Permission.NONE;
}
access.log(Level.INFO,"Permissions on",rname,"for",uname,':', permissions);
return permissions;
}
开发者ID:att,项目名称:AAF,代码行数:29,代码来源:AAFAuthorizer.java
示例20: checkPermissions
import org.apache.cassandra.auth.Permission; //导入依赖的package包/类
/**
* Check only for Localized IDs (see cadi.properties)
* @param aau
* @param perm
* @return
*/
private Set<Permission> checkPermissions(AAFAuthenticatedUser aau, LocalPermission perm) {
if(localLur.fish(aau.getFullName(), perm)) {
// aau.setSuper(true);
return Permission.ALL;
} else {
return Permission.NONE;
}
}
开发者ID:att,项目名称:AAF,代码行数:15,代码来源:AAFAuthorizer.java
注:本文中的org.apache.cassandra.auth.Permission类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论