Class RoleResource

java.lang.Object
org.apache.cassandra.auth.RoleResource
All Implemented Interfaces:
Comparable<RoleResource>, IResource

public class RoleResource extends Object implements IResource, 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 Details

    • root

      public static RoleResource root()
      Returns:
      the root-level resource.
    • role

      public static RoleResource role(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(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 String getName()
      Specified by:
      getName in interface IResource
      Returns:
      Printable name of the resource.
    • getRoleName

      public 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: IResource
      Gets next resource in the hierarchy. Call hasParent first to make sure there is one.
      Specified by:
      getParent in interface IResource
      Returns:
      Parent of the resource, if any. Throws IllegalStateException if it's the root-level resource.
    • hasParent

      public boolean hasParent()
      Description copied from interface: IResource
      Indicates whether or not this resource has a parent in the hierarchy. Please perform this check before calling getParent() method.
      Specified by:
      hasParent in interface IResource
      Returns:
      Whether or not the resource has a parent.
    • exists

      public boolean exists()
      Specified by:
      exists in interface IResource
      Returns:
      Whether or not this resource exists in Cassandra.
    • applicablePermissions

      public Set<Permission> applicablePermissions()
      Description copied from interface: IResource
      Returns 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:
      applicablePermissions in interface IResource
      Returns:
      the permissions that may be granted on the specific resource
    • compareTo

      public int compareTo(RoleResource o)
      Specified by:
      compareTo in interface Comparable<RoleResource>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object