Class AbstractPermissionNode
- java.lang.Object
-
- org.uberfire.security.client.authz.tree.impl.AbstractPermissionNode
-
- All Implemented Interfaces:
PermissionNode
- Direct Known Subclasses:
PermissionGroupNode,PermissionLeafNode,PermissionResourceNode
public class AbstractPermissionNode extends Object implements PermissionNode
-
-
Constructor Summary
Constructors Constructor Description AbstractPermissionNode()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDependencies(org.uberfire.security.authz.Permission permission, org.uberfire.security.authz.Permission... dependencies)Attach to the givenPermissioninstance a set of permissions which depends on it so that if the permission is denied then all its dependencies must be denied as well.voidaddPermission(org.uberfire.security.authz.Permission permission, String name)Add a permission instance to the listvoidaddPermission(org.uberfire.security.authz.Permission permission, String grantName, String denyName)Add a permission instance to the listvoidcollapse()Collapse the nodevoidexpand(LoadCallback callback)Expand the node.List<org.uberfire.security.authz.Permission>getDependencies(org.uberfire.security.authz.Permission permission)Get the dependencies (if any) attached to a given permission instance.intgetLevel()A number indicating at what specific levels this node is placed within thePermissionTreeStringgetNodeFullName()Retrieves the full name to display for the given node.StringgetNodeName()Retrieves the name to display for the given node.PermissionNodegetParentNode()Get the parent node.StringgetPermissionDenyName(org.uberfire.security.authz.Permission permission)Retrieves the name to display for the deny action.StringgetPermissionGrantName(org.uberfire.security.authz.Permission permission)Retrieves the name to display for the grant action.List<org.uberfire.security.authz.Permission>getPermissionList()The list of permissions attached to this node.PermissionTreegetPermissionTree()Get thePermissionTreeinstance this root node has been attached to.PermissionTreeProvidergetPermissionTreeProvider()Get the provider instance that built this node instance.intgetPositionInTree()The position of the node within the permission tree.ObjectgetProperty(String key)Get a property attached to this nodebooleanimpliesName(org.uberfire.security.authz.Permission other)List<org.uberfire.security.authz.Permission>impliesName(PermissionNode node)Retrieve the permissions of the specified node that are implied by this node's permissions.booleanisExpanded()Get the expand statusbooleanpropertyEquals(String key, Object value)Check if a property exists and matchs the given valuevoidsetNodeFullName(String nodeFullName)voidsetNodeName(String nodeName)voidsetParentNode(PermissionNode parentNode)Set this node's parentvoidsetPermissionDenyName(org.uberfire.security.authz.Permission permission, String name)voidsetPermissionGrantName(org.uberfire.security.authz.Permission permission, String name)voidsetPermissionTree(PermissionTree permissionTree)Attach this root node to the givenPermissionTreeinstance.voidsetPermissionTreeProvider(PermissionTreeProvider permissionTreeProvider)Set the provider instance that built this node instance.voidsetPositionInTree(int positionInTree)voidsetProperty(String key, Object value)Attach a property to this nodevoidupdatePermissionList(org.uberfire.security.authz.PermissionCollection permissions)Updates the node's permission values according to the values specified in the given collection.
-
-
-
Method Detail
-
getPermissionTree
public PermissionTree getPermissionTree()
Description copied from interface:PermissionNodeGet thePermissionTreeinstance this root node has been attached to.- Specified by:
getPermissionTreein interfacePermissionNode
-
setPermissionTree
public void setPermissionTree(PermissionTree permissionTree)
Description copied from interface:PermissionNodeAttach this root node to the givenPermissionTreeinstance.- Specified by:
setPermissionTreein interfacePermissionNode
-
getPermissionTreeProvider
public PermissionTreeProvider getPermissionTreeProvider()
Description copied from interface:PermissionNodeGet the provider instance that built this node instance.- Specified by:
getPermissionTreeProviderin interfacePermissionNode
-
setPermissionTreeProvider
public void setPermissionTreeProvider(PermissionTreeProvider permissionTreeProvider)
Description copied from interface:PermissionNodeSet the provider instance that built this node instance.- Specified by:
setPermissionTreeProviderin interfacePermissionNode
-
getParentNode
public PermissionNode getParentNode()
Description copied from interface:PermissionNodeGet the parent node.- Specified by:
getParentNodein interfacePermissionNode- Returns:
- null if this is a root node
-
setParentNode
public void setParentNode(PermissionNode parentNode)
Description copied from interface:PermissionNodeSet this node's parent- Specified by:
setParentNodein interfacePermissionNode
-
getPermissionList
public List<org.uberfire.security.authz.Permission> getPermissionList()
Description copied from interface:PermissionNodeThe list of permissions attached to this node.- Specified by:
getPermissionListin interfacePermissionNode
-
addPermission
public void addPermission(org.uberfire.security.authz.Permission permission, String name)Description copied from interface:PermissionNodeAdd a permission instance to the list- Specified by:
addPermissionin interfacePermissionNode
-
addPermission
public void addPermission(org.uberfire.security.authz.Permission permission, String grantName, String denyName)Description copied from interface:PermissionNodeAdd a permission instance to the list- Specified by:
addPermissionin interfacePermissionNode
-
isExpanded
public boolean isExpanded()
Description copied from interface:PermissionNodeGet the expand status- Specified by:
isExpandedin interfacePermissionNode- Returns:
- true if expanded, false if collapsed
-
getProperty
public Object getProperty(String key)
Description copied from interface:PermissionNodeGet a property attached to this node- Specified by:
getPropertyin interfacePermissionNode- Parameters:
key- The property key- Returns:
- The value object
-
setProperty
public void setProperty(String key, Object value)
Description copied from interface:PermissionNodeAttach a property to this node- Specified by:
setPropertyin interfacePermissionNode- Parameters:
key- The property keyvalue- The value object
-
propertyEquals
public boolean propertyEquals(String key, Object value)
Description copied from interface:PermissionNodeCheck if a property exists and matchs the given value- Specified by:
propertyEqualsin interfacePermissionNode- Parameters:
key- The property keyvalue- The value object to check
-
getPositionInTree
public int getPositionInTree()
Description copied from interface:PermissionNodeThe position of the node within the permission tree. The position is used byPermissionTreeimplementations to order its root nodes from lower position nodes to higher ones.- Specified by:
getPositionInTreein interfacePermissionNode
-
setPositionInTree
public void setPositionInTree(int positionInTree)
-
getNodeName
public String getNodeName()
Description copied from interface:PermissionNodeRetrieves the name to display for the given node.- Specified by:
getNodeNamein interfacePermissionNode- Returns:
- The name to display in the UI
-
setNodeName
public void setNodeName(String nodeName)
-
getNodeFullName
public String getNodeFullName()
Description copied from interface:PermissionNodeRetrieves the full name to display for the given node.- Specified by:
getNodeFullNamein interfacePermissionNode- Returns:
- The name to display in the UI
-
setNodeFullName
public void setNodeFullName(String nodeFullName)
-
getPermissionGrantName
public String getPermissionGrantName(org.uberfire.security.authz.Permission permission)
Description copied from interface:PermissionNodeRetrieves the name to display for the grant action.- Specified by:
getPermissionGrantNamein interfacePermissionNode- Parameters:
permission- ThePermissioninstance- Returns:
- The name to display in the UI
-
setPermissionGrantName
public void setPermissionGrantName(org.uberfire.security.authz.Permission permission, String name)
-
getPermissionDenyName
public String getPermissionDenyName(org.uberfire.security.authz.Permission permission)
Description copied from interface:PermissionNodeRetrieves the name to display for the deny action.- Specified by:
getPermissionDenyNamein interfacePermissionNode- Parameters:
permission- ThePermissioninstance- Returns:
- The name to display in the UI
-
setPermissionDenyName
public void setPermissionDenyName(org.uberfire.security.authz.Permission permission, String name)
-
impliesName
public List<org.uberfire.security.authz.Permission> impliesName(PermissionNode node)
Description copied from interface:PermissionNodeRetrieve the permissions of the specified node that are implied by this node's permissions.- Specified by:
impliesNamein interfacePermissionNode- Returns:
- A sub-list of
Permissioninstances
-
impliesName
public boolean impliesName(org.uberfire.security.authz.Permission other)
-
updatePermissionList
public void updatePermissionList(org.uberfire.security.authz.PermissionCollection permissions)
Description copied from interface:PermissionNodeUpdates the node's permission values according to the values specified in the given collection.- Specified by:
updatePermissionListin interfacePermissionNode- Parameters:
permissions- The permission collection with the results to apply.
-
addDependencies
public void addDependencies(org.uberfire.security.authz.Permission permission, org.uberfire.security.authz.Permission... dependencies)Description copied from interface:PermissionNodeAttach to the givenPermissioninstance a set of permissions which depends on it so that if the permission is denied then all its dependencies must be denied as well.For instance, the update and delete permission over a resource depends on the read permission.
- Specified by:
addDependenciesin interfacePermissionNode- Parameters:
permission- ThePermissioninstancedependencies- The set of dependencies
-
getDependencies
public List<org.uberfire.security.authz.Permission> getDependencies(org.uberfire.security.authz.Permission permission)
Description copied from interface:PermissionNodeGet the dependencies (if any) attached to a given permission instance.- Specified by:
getDependenciesin interfacePermissionNode- Parameters:
permission- The permission to check- Returns:
- A list of permissions
-
getLevel
public int getLevel()
Description copied from interface:PermissionNodeA number indicating at what specific levels this node is placed within thePermissionTree- Specified by:
getLevelin interfacePermissionNode- Returns:
- A positive integer from 0 to N, where 0=root, N=leaf.
-
expand
public void expand(LoadCallback callback)
Description copied from interface:PermissionNodeExpand the node.The children nodes are loaded asynchronously and the consumer instance passed as a parameter is invoked after the loading process is done.
It does nothing in case the node is already expanded.
- Specified by:
expandin interfacePermissionNode- Parameters:
callback- The callback instance that consumes the children nodes.
-
collapse
public void collapse()
Description copied from interface:PermissionNodeCollapse the node- Specified by:
collapsein interfacePermissionNode
-
-