public class CassandraRoleManager extends java.lang.Object implements IRoleManager
IRoleManager.Option
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
LEGACY_USERS_TABLE |
Constructor and Description |
---|
CassandraRoleManager() |
Modifier and Type | Method and Description |
---|---|
java.util.Set<IRoleManager.Option> |
alterableOptions()
Subset of supportedOptions that users are allowed to alter when performing ALTER ROLE [themselves].
|
void |
alterRole(AuthenticatedUser performer,
RoleResource role,
RoleOptions options)
Called during execution of ALTER ROLE statement.
|
boolean |
canLogin(RoleResource role)
Return true if there exists a Role with the given name which has login
privileges.
|
protected static ConsistencyLevel |
consistencyForRole(java.lang.String role) |
void |
createRole(AuthenticatedUser performer,
RoleResource role,
RoleOptions options)
Called during execution of a CREATE ROLE statement.
|
void |
dropRole(AuthenticatedUser performer,
RoleResource role)
Called during execution of DROP ROLE statement, as well we removing any main record of the role from the system
this implies that we want to revoke this role from all other roles that it has been granted to.
|
java.util.Set<RoleResource> |
getAllRoles()
Called during the execution of an unqualified LIST ROLES query.
|
java.util.Map<java.lang.String,java.lang.String> |
getCustomOptions(RoleResource role)
Where an implementation supports OPTIONS in CREATE and ALTER operations
this method should return the Map
|
java.util.Set<RoleResource> |
getRoles(RoleResource grantee,
boolean includeInherited)
Called during execution of a LIST ROLES query.
|
void |
grantRole(AuthenticatedUser performer,
RoleResource role,
RoleResource grantee)
Called during execution of GRANT ROLE query.
|
boolean |
isExistingRole(RoleResource role)
Return true is a Role with the given name exists in the system.
|
boolean |
isSuper(RoleResource role)
Return true if there exists a Role with the given name that also has
superuser status.
|
java.util.Set<? extends IResource> |
protectedResources()
Set of resources that should be made inaccessible to users and only accessible internally.
|
void |
revokeRole(AuthenticatedUser performer,
RoleResource role,
RoleResource revokee)
Called during the execution of a REVOKE ROLE query.
|
void |
setup()
Hook to perform implementation specific initialization, called once upon system startup.
|
java.util.Set<IRoleManager.Option> |
supportedOptions()
Set of options supported by CREATE ROLE and ALTER ROLE queries.
|
void |
validateConfiguration()
Hook to perform validation of an implementation's configuration (if supported).
|
public static final java.lang.String LEGACY_USERS_TABLE
public void setup()
IRoleManager
setup
in interface IRoleManager
public java.util.Set<IRoleManager.Option> supportedOptions()
IRoleManager
supportedOptions
in interface IRoleManager
public java.util.Set<IRoleManager.Option> alterableOptions()
IRoleManager
alterableOptions
in interface IRoleManager
public void createRole(AuthenticatedUser performer, RoleResource role, RoleOptions options) throws RequestValidationException, RequestExecutionException
IRoleManager
createRole
in interface IRoleManager
performer
- User issuing the create role statement.role
- Rolei being createdoptions
- Options the role will be created withRequestValidationException
RequestExecutionException
public void dropRole(AuthenticatedUser performer, RoleResource role) throws RequestValidationException, RequestExecutionException
IRoleManager
dropRole
in interface IRoleManager
performer
- User issuing the drop role statement.role
- Role to be dropped.RequestValidationException
RequestExecutionException
public void alterRole(AuthenticatedUser performer, RoleResource role, RoleOptions options)
IRoleManager
alterRole
in interface IRoleManager
performer
- User issuing the alter role statement.role
- Role that will be altered.options
- Options to alter.public void grantRole(AuthenticatedUser performer, RoleResource role, RoleResource grantee) throws RequestValidationException, RequestExecutionException
IRoleManager
grantRole
in interface IRoleManager
performer
- User issuing the grant statement.role
- Role to be granted to the grantee.grantee
- Role acting as the grantee.RequestValidationException
RequestExecutionException
public void revokeRole(AuthenticatedUser performer, RoleResource role, RoleResource revokee) throws RequestValidationException, RequestExecutionException
IRoleManager
revokeRole
in interface IRoleManager
performer
- User issuing the revoke statement.role
- Role to be revoked.revokee
- Role from which the granted role is to be revoked.RequestValidationException
RequestExecutionException
public java.util.Set<RoleResource> getRoles(RoleResource grantee, boolean includeInherited) throws RequestValidationException, RequestExecutionException
IRoleManager
getRoles
in interface IRoleManager
grantee
- Role whose granted roles will be listed.includeInherited
- if True will list inherited roles as well as those directly granted to the grantee.RequestValidationException
RequestExecutionException
public java.util.Set<RoleResource> getAllRoles() throws RequestValidationException, RequestExecutionException
IRoleManager
getAllRoles
in interface IRoleManager
RequestValidationException
RequestExecutionException
public boolean isSuper(RoleResource role)
IRoleManager
isSuper
in interface IRoleManager
role
- Role whose superuser status to verifypublic boolean canLogin(RoleResource role)
IRoleManager
canLogin
in interface IRoleManager
role
- Role whose login privileges to verifypublic java.util.Map<java.lang.String,java.lang.String> getCustomOptions(RoleResource role)
IRoleManager
getCustomOptions
in interface IRoleManager
role
- Role whose custom options are requiredpublic boolean isExistingRole(RoleResource role)
IRoleManager
isExistingRole
in interface IRoleManager
role
- Role whose existence to verifypublic java.util.Set<? extends IResource> protectedResources()
IRoleManager
protectedResources
in interface IRoleManager
public void validateConfiguration() throws ConfigurationException
IRoleManager
validateConfiguration
in interface IRoleManager
ConfigurationException
protected static ConsistencyLevel consistencyForRole(java.lang.String role)
Copyright © 2017 The Apache Software Foundation