Class CollectionPermissionImpl

java.lang.Object
ddf.security.permission.impl.CollectionPermissionImpl
All Implemented Interfaces:
ddf.security.permission.CollectionPermission, org.apache.shiro.authz.Permission
Direct Known Subclasses:
KeyValueCollectionPermissionImpl, MatchOneCollectionPermission

public class CollectionPermissionImpl extends Object implements ddf.security.permission.CollectionPermission
Permission class handling a collection of permissions and handling the logic to determine if one collection of permissions can imply another collection of permissions. Assumes the underlying permissions can handle instances of differing permission types.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected String
     
    protected List<org.apache.shiro.authz.Permission>
     

    Fields inherited from interface ddf.security.permission.CollectionPermission

    CREATE_ACTION, DELETE_ACTION, PERMISSION_END_MSG, PERMISSION_IMPLIES_MSG, PERMISSION_NOT_IMPLIES_MSG, PERMISSION_START_MSG, READ_ACTION, UNKNOWN_ACTION, UPDATE_ACTION
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor creating an empty collection of permissions.
     
    CollectionPermissionImpl(String action, Collection<? extends org.apache.shiro.authz.Permission> permissions)
    Creates a new collection of permissions from an existing collection of permissions.
    CollectionPermissionImpl(String action, org.apache.shiro.authz.Permission... permissions)
    Creates a new collection of permissions and adds the provided permissions to the collection.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addAll(Collection<? extends org.apache.shiro.authz.Permission> permissions)
    Adds all of the incoming permissions to this collection.
    void
    Clears out all of the permissions currently in this collection.
    Returns the action associated with this collection of permissions
    List<org.apache.shiro.authz.Permission>
    Returns this collection as an unmodifiable list of permissions.
    boolean
    implies(org.apache.shiro.authz.Permission p)
    Returns true if this current instance implies all the functionality and/or resource access described by the specified Permission argument, false otherwise.
    boolean
    Returns true if the internal permissions list is empty otherwise returns false
    void
    setAction(String action)
    Sets the action for this collection of permissions
    String representation of this collection of permissions.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • permissionList

      protected List<org.apache.shiro.authz.Permission> permissionList
    • action

      protected String action
  • Constructor Details

    • CollectionPermissionImpl

      public CollectionPermissionImpl()
      Default constructor creating an empty collection of permissions.
    • CollectionPermissionImpl

      public CollectionPermissionImpl(String action)
      Parameters:
      action - Action associated with this collection of permissions
    • CollectionPermissionImpl

      public CollectionPermissionImpl(String action, org.apache.shiro.authz.Permission... permissions)
      Creates a new collection of permissions and adds the provided permissions to the collection.
      Parameters:
      action - Action associated with this collection of permissions
      permissions - permission objects to be added to the newly created collection
    • CollectionPermissionImpl

      public CollectionPermissionImpl(String action, Collection<? extends org.apache.shiro.authz.Permission> permissions)
      Creates a new collection of permissions from an existing collection of permissions. All permissions in the provided collection are added to the newly created collection.
      Parameters:
      action - Action associated with this collection of permissions
      permissions - existing collection of permission objects
  • Method Details

    • implies

      public boolean implies(org.apache.shiro.authz.Permission p)
      Returns true if this current instance implies all the functionality and/or resource access described by the specified Permission argument, false otherwise.

      That is, this current instance must be exactly equal to or a superset of the functionalty and/or resource access described by the given Permission argument. Yet another way of saying this would be:

      If "permission1 implies permission2", i.e. permission1.implies(permission2) , then any Subject granted permission1 would have ability greater than or equal to that defined by permission2.

      Specified by:
      implies in interface org.apache.shiro.authz.Permission
      Parameters:
      p - the permission to check for behavior/functionality comparison.
      Returns:
      true if this current instance implies all the functionality and/or resource access described by the specified Permission argument, false otherwise.
    • getPermissionList

      public List<org.apache.shiro.authz.Permission> getPermissionList()
      Returns this collection as an unmodifiable list of permissions.
      Specified by:
      getPermissionList in interface ddf.security.permission.CollectionPermission
      Returns:
      unmodifiable List of permissions corresponding to this collection
    • isEmpty

      public boolean isEmpty()
      Returns true if the internal permissions list is empty otherwise returns false
      Specified by:
      isEmpty in interface ddf.security.permission.CollectionPermission
      Returns:
    • toString

      public String toString()
      String representation of this collection of permissions. Depends on the toString method of each permission.
      Overrides:
      toString in class Object
      Returns:
      String representation of this collection of permissions
    • clear

      public void clear()
      Clears out all of the permissions currently in this collection.
      Specified by:
      clear in interface ddf.security.permission.CollectionPermission
    • addAll

      public void addAll(Collection<? extends org.apache.shiro.authz.Permission> permissions)
      Adds all of the incoming permissions to this collection.
      Specified by:
      addAll in interface ddf.security.permission.CollectionPermission
      Parameters:
      permissions - The permissions that should be added.
    • getAction

      public String getAction()
      Returns the action associated with this collection of permissions
      Specified by:
      getAction in interface ddf.security.permission.CollectionPermission
      Returns:
    • setAction

      public void setAction(String action)
      Sets the action for this collection of permissions
      Specified by:
      setAction in interface ddf.security.permission.CollectionPermission
      Parameters:
      action -