Package org.apache.cassandra.auth
Class RoleResource
- java.lang.Object
-
- org.apache.cassandra.auth.RoleResource
-
- All Implemented Interfaces:
java.lang.Comparable<RoleResource>,IResource
public class RoleResource extends java.lang.Object implements IResource, java.lang.Comparable<RoleResource>
IResource implementation representing database roles. The root level "roles" resource represents the collection of all Roles. Individual roles are represented as members of the collection: "roles" - the root level collection resource "roles/role1" - a specific database role
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<Permission>applicablePermissions()Returns the set of Permissions that may be applied to this resource Certain permissions are not applicable to particular types of resources.intcompareTo(RoleResource o)booleanequals(java.lang.Object o)booleanexists()static RoleResourcefromName(java.lang.String name)Parses a role resource name into a RoleResource instance.java.lang.StringgetName()IResourcegetParent()Gets next resource in the hierarchy.java.lang.StringgetRoleName()inthashCode()booleanhasParent()Indicates whether or not this resource has a parent in the hierarchy.static RoleResourcerole(java.lang.String name)Creates a RoleResource representing an individual Role.static RoleResourceroot()java.lang.StringtoString()
-
-
-
Method Detail
-
root
public static RoleResource root()
- Returns:
- the root-level resource.
-
role
public static RoleResource role(java.lang.String name)
Creates a RoleResource representing an individual Role.- Parameters:
name- name of the Role.- Returns:
- RoleResource instance reresenting the Role.
-
fromName
public static RoleResource fromName(java.lang.String name)
Parses a role resource name into a RoleResource instance.- Parameters:
name- Name of the data resource.- Returns:
- RoleResource instance matching the name.
-
getName
public java.lang.String getName()
-
getRoleName
public java.lang.String getRoleName()
- Returns:
- short form name of a role level resource. i.e. not the full "root/name" version returned by getName(). Throws IllegalStateException if called on the root-level resource.
-
getParent
public IResource getParent()
Description copied from interface:IResourceGets next resource in the hierarchy. Call hasParent first to make sure there is one.
-
hasParent
public boolean hasParent()
Description copied from interface:IResourceIndicates whether or not this resource has a parent in the hierarchy. Please perform this check before calling getParent() method.
-
exists
public boolean exists()
-
applicablePermissions
public java.util.Set<Permission> applicablePermissions()
Description copied from interface:IResourceReturns the set of Permissions that may be applied to this resource Certain permissions are not applicable to particular types of resources. For instance, it makes no sense to talk about CREATE permission on table, or SELECT on a Role. Here we filter a set of permissions depending on the specific resource they're being applied to. This is necessary because the CQL syntax supports ALL as wildcard, but the set of permissions that should resolve to varies by IResource.- Specified by:
applicablePermissionsin interfaceIResource- Returns:
- the permissions that may be granted on the specific resource
-
compareTo
public int compareTo(RoleResource o)
- Specified by:
compareToin interfacejava.lang.Comparable<RoleResource>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-