Class ActionPermission
- java.lang.Object
-
- org.wicketstuff.security.hive.authorization.Permission
-
- org.wicketstuff.security.hive.authorization.permissions.ActionPermission
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
AllPermissions
public class ActionPermission extends Permission
Base class for any Permission that uses actions. Each implementation of ActionPermission should at least expose the ActionPermission(String name, SwarmAction actions) constructor to the outside world, for it will be used by aHiveFactorywhen constructing permissions. Note if you do not wish to use actions in your permissions you should build your own permissions.- Author:
- marrink
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedActionPermission(String name, org.wicketstuff.security.actions.WaspAction actions)Creates a new ActionPermission with the specified name and actions.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)ActionPermissions are only equal if they have the same class, name and actions.protected org.wicketstuff.security.actions.WaspActiongetAction()The internal representation of this action.StringgetActions()A logically ordered comma separated string containing each action this permission has.inthashCode()generates a hashcode including the classname.booleanimplies(Permission permission)Performs a logical and to see if this permission has at least all the actions as the other permission and thus if this permission implies the other permission.StringtoString()-
Methods inherited from class org.wicketstuff.security.hive.authorization.Permission
getName
-
-
-
-
Constructor Detail
-
ActionPermission
protected ActionPermission(String name, org.wicketstuff.security.actions.WaspAction actions)
Creates a new ActionPermission with the specified name and actions.- Parameters:
name- non null name of the permissionactions- a logical and of all the allowed / required actions for this permission
-
-
Method Detail
-
implies
public boolean implies(Permission permission)
Performs a logical and to see if this permission has at least all the actions as the other permission and thus if this permission implies the other permission. Inherited actions are considered.Some basic rules about implies:
- if 2 permissions are equal both should imply the other.
- if 2 permissions are not equal they might still imply each other, or 1 might implies the other but not vice versa
- a permission should imply another permission if they are of the same class and the first has at least, all the actions of the second permission and they have the same name.
- a permission should imply another permission if there is some kind of hierarchical structure between them and the other permission is able to inherit the required actions from the first permission. To further clarify the part about inheritance. This implementation implies any type of ActionPermission under the following conditions.
- Equal name and actions
- This permission has the inherit action and all or more of the other permissions actions and the name of the other permission starts with the name of this permission.
Subclasses like DataPermission that only wish to imply other DataPermissions could simply override implies like this.if (permission instanceof DataPermission) return super.implies(permission); return false;Note that this does not prevent other subclasses from ActionPermission to imply your permission (as stated above).- Specified by:
impliesin classPermission- Returns:
- true if this implies the permission, false otherwise.
- See Also:
Permission.implies(Permission)
-
equals
public boolean equals(Object obj)
ActionPermissions are only equal if they have the same class, name and actions.- Specified by:
equalsin classPermission- Parameters:
obj- the object we are testing for equality with this object.- Returns:
- true if both Permission objects are equivalent.
- See Also:
Permission.equals(java.lang.Object)
-
hashCode
public int hashCode()
generates a hashcode including the classname.- Specified by:
hashCodein classPermission- Returns:
- a hash code value for this object.
- See Also:
Permission.hashCode()
-
getActions
public final String getActions()
A logically ordered comma separated string containing each action this permission has.- Specified by:
getActionsin classPermission- Returns:
- the actions of this Permission.
- See Also:
Permission.getActions()
-
toString
public String toString()
- Overrides:
toStringin classObject- See Also:
Object.toString()
-
getAction
protected final org.wicketstuff.security.actions.WaspAction getAction()
The internal representation of this action.- Returns:
- the action
-
-