org.jboss.dashboard.security
Class DefaultPermission
java.lang.Object
java.security.Permission
org.jboss.dashboard.security.DefaultPermission
- All Implemented Interfaces:
- Serializable, Guard
public class DefaultPermission
- extends Permission
- See Also:
- Serialized Form
PERMISSION_GRANTED
public static final int PERMISSION_GRANTED
- See Also:
- Constant Field Values
PERMISSION_NOT_GRANTED
public static final int PERMISSION_NOT_GRANTED
- See Also:
- Constant Field Values
PERMISSION_DENIED
public static final int PERMISSION_DENIED
- See Also:
- Constant Field Values
DefaultPermission
public DefaultPermission(String resourceName,
String actions)
- Creates a permission over the specified resource.
- Parameters:
resourceName - A path to a resource. The naming
convention follows the hierarchical property naming convention.
The path format is the following: workspace{workspaceId}>.section{sectionId}.panel{panelId}.
An asterisk may appear at the end of the name, following a ".", or by itself, to
signify a wildcard equals. For example: java.*, "workspace101.section102.*"
setResourceName
public void setResourceName(String resourceName)
getResourcePath
public String getResourcePath()
setActions
public void setActions(String actions)
grantAction
public void grantAction(String action)
denyAction
public void denyAction(String action)
removeAction
public void removeAction(String action)
isActionGranted
public boolean isActionGranted(String action)
isActionDenied
public boolean isActionDenied(String action)
isActionUndefined
public boolean isActionUndefined(String action)
isEmpty
public boolean isEmpty()
- If no actions are defined for this permission then assume as empty.
impliesOrDenies
public int impliesOrDenies(Permission p)
- Check both if this permission implies or denies the specified one.
- Parameters:
p - The permission to check.
- Returns:
- A grant code. See constants definition at top of this class.
implies
public boolean implies(Permission p)
- Specified by:
implies in class Permission
newPermissionCollection
public PermissionCollection newPermissionCollection()
- Overrides:
newPermissionCollection in class Permission
equals
public boolean equals(Object obj)
- Checks two BasicPermission objects for equality.
Checks that obj's class is the same as this object's class
and has the same name as this object.
- Specified by:
equals in class Permission
- Parameters:
obj - the object we are testing for equality with this object.
- Returns:
- true if obj is a BasicPermission, and has the same name
as this BasicPermission object, false otherwise.
hashCode
public int hashCode()
- Specified by:
hashCode in class Permission
getActions
public String getActions()
- Specified by:
getActions in class Permission
- Returns:
- Actions granted/denied by this permission instance.
The string format is a list of words separated each one by a comma-character.
An action is denied if is preceeded by the character "!". Samples are:
"view" or "view, !edit".
toActionListString
protected String toActionListString()
toActionGrantedList
protected List<String> toActionGrantedList(String actionsString)
toActionDeniedList
protected List<String> toActionDeniedList(String actionsString)
toString
public String toString()
- Overrides:
toString in class Permission
Copyright © 2012-2014 JBoss by Red Hat. All Rights Reserved.