Package ddf.security.permission.impl
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
FieldsModifier and TypeFieldDescriptionprotected Stringprotected 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
ConstructorsConstructorDescriptionDefault constructor creating an empty collection of permissions.CollectionPermissionImpl(String action) 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 TypeMethodDescriptionvoidaddAll(Collection<? extends org.apache.shiro.authz.Permission> permissions) Adds all of the incoming permissions to this collection.voidclear()Clears out all of the permissions currently in this collection.Returns the action associated with this collection of permissionsList<org.apache.shiro.authz.Permission> Returns this collection as an unmodifiable list of permissions.booleanimplies(org.apache.shiro.authz.Permission p) Returnstrueif this current instance implies all the functionality and/or resource access described by the specifiedPermissionargument,falseotherwise.booleanisEmpty()Returns true if the internal permissions list is empty otherwise returns falsevoidSets the action for this collection of permissionstoString()String representation of this collection of permissions.
-
Field Details
-
permissionList
-
action
-
-
Constructor Details
-
CollectionPermissionImpl
public CollectionPermissionImpl()Default constructor creating an empty collection of permissions. -
CollectionPermissionImpl
- Parameters:
action- Action associated with this collection of permissions
-
CollectionPermissionImpl
Creates a new collection of permissions and adds the provided permissions to the collection.- Parameters:
action- Action associated with this collection of permissionspermissions- 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 permissionspermissions- existing collection of permission objects
-
-
Method Details
-
implies
public boolean implies(org.apache.shiro.authz.Permission p) Returnstrueif this current instance implies all the functionality and/or resource access described by the specifiedPermissionargument,falseotherwise.That is, this current instance must be exactly equal to or a superset of the functionalty and/or resource access described by the given
Permissionargument. Yet another way of saying this would be:If "permission1 implies permission2", i.e.
permission1.implies(permission2), then any Subject grantedpermission1would have ability greater than or equal to that defined bypermission2.- Specified by:
impliesin interfaceorg.apache.shiro.authz.Permission- Parameters:
p- the permission to check for behavior/functionality comparison.- Returns:
trueif this current instance implies all the functionality and/or resource access described by the specifiedPermissionargument,falseotherwise.
-
getPermissionList
Returns this collection as an unmodifiable list of permissions.- Specified by:
getPermissionListin interfaceddf.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:
isEmptyin interfaceddf.security.permission.CollectionPermission- Returns:
-
toString
String representation of this collection of permissions. Depends on the toString method of each permission. -
clear
public void clear()Clears out all of the permissions currently in this collection.- Specified by:
clearin interfaceddf.security.permission.CollectionPermission
-
addAll
Adds all of the incoming permissions to this collection.- Specified by:
addAllin interfaceddf.security.permission.CollectionPermission- Parameters:
permissions- The permissions that should be added.
-
getAction
Returns the action associated with this collection of permissions- Specified by:
getActionin interfaceddf.security.permission.CollectionPermission- Returns:
-
setAction
Sets the action for this collection of permissions- Specified by:
setActionin interfaceddf.security.permission.CollectionPermission- Parameters:
action-
-