Class DynamicAccessControlListImpl
- java.lang.Object
-
- org.apache.fulcrum.security.model.dynamic.DynamicAccessControlListImpl
-
- All Implemented Interfaces:
Serializable,AccessControlList,DynamicAccessControlList
public class DynamicAccessControlListImpl extends Object implements DynamicAccessControlList
This is a control class that makes it easy to find out if a particular User has a given Permission. It also determines if a User has a a particular Role.- Version:
- $Id$
- Author:
- Eric Pugh
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DynamicAccessControlListImpl(Map<? extends Group,? extends RoleSet> roleSets, Map<? extends Role,? extends PermissionSet> permissionSets)Constructs a new AccessControlList.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PermissionSetgetPermissions()Retrieves a set of Permissions an user is assigned in the global Group.PermissionSetgetPermissions(Group group)Retrieves a set of Permissions an user is assigned in a Group.RoleSetgetRoles()Retrieves a set of Roles an user is assigned in the global Group.RoleSetgetRoles(Group group)Retrieves a set of Roles an user is assigned in a Group.booleanhasPermission(String permission)Checks if the user is assigned a specific Permission in the global Group.booleanhasPermission(String permission, String group)Checks if the user is assigned a specific Permission in the Group.booleanhasPermission(String permission, Group group)Checks if the user is assigned a specific Permission in the Group.booleanhasPermission(String permissionName, GroupSet groupset)Checks if the user is assigned a specific Permission in any of the given GroupsbooleanhasPermission(Permission permission)Checks if the user is assigned a specific Permission.booleanhasPermission(Permission permission, Group group)Checks if the user is assigned a specific Permission in the Group.booleanhasPermission(Permission permission, GroupSet groupset)Checks if the user is assigned a specific Permission in any of the given GroupsbooleanhasRole(String role)Checks if the user is assigned a specific Role .booleanhasRole(String role, String group)Checks if the user is assigned a specific Role in the Group.booleanhasRole(String rolename, GroupSet groupset)Checks if the user is assigned a specific Role in any of the given GroupsbooleanhasRole(Role role)Checks if the user is assigned a specific RolebooleanhasRole(Role role, Group group)Checks if the user is assigned a specific Role in the Group.booleanhasRole(Role role, GroupSet groupset)Checks if the user is assigned a specific Role in any of the given Groups
-
-
-
Constructor Detail
-
DynamicAccessControlListImpl
public DynamicAccessControlListImpl(Map<? extends Group,? extends RoleSet> roleSets, Map<? extends Role,? extends PermissionSet> permissionSets)
Constructs a new AccessControlList. This class follows 'immutable' pattern - it's objects can't be modified once they are created. This means that the permissions the users have are in effect form the moment they log in to the moment they log out, and changes made to the security settings in that time are not reflected in the state of this object. If you need to reset an user's permissions you need to invalidate his session.
The objects that constructs an AccessControlList must supply hashtables of role/permission sets keyed with group objects.- Parameters:
roleSets- a hashtable containing RoleSet objects keyed with Group objectspermissionSets- a hashtable containing PermissionSet objects keyed with Roles objects
-
-
Method Detail
-
getRoles
public RoleSet getRoles(Group group)
Retrieves a set of Roles an user is assigned in a Group.- Specified by:
getRolesin interfaceDynamicAccessControlList- Parameters:
group- the Group- Returns:
- the set of Roles this user has within the Group.
-
getRoles
public RoleSet getRoles()
Retrieves a set of Roles an user is assigned in the global Group.- Specified by:
getRolesin interfaceDynamicAccessControlList- Returns:
- the set of Roles this user has within the global Group.
-
getPermissions
public PermissionSet getPermissions(Group group)
Retrieves a set of Permissions an user is assigned in a Group.- Specified by:
getPermissionsin interfaceDynamicAccessControlList- Parameters:
group- the Group- Returns:
- the set of Permissions this user has within the Group.
-
getPermissions
public PermissionSet getPermissions()
Retrieves a set of Permissions an user is assigned in the global Group.- Specified by:
getPermissionsin interfaceDynamicAccessControlList- Returns:
- the set of Permissions this user has within the global Group.
-
hasRole
public boolean hasRole(Role role, Group group)
Checks if the user is assigned a specific Role in the Group.- Specified by:
hasRolein interfaceDynamicAccessControlList- Parameters:
role- the Rolegroup- the Group- Returns:
trueif the user is assigned the Role in the Group.
-
hasRole
public boolean hasRole(Role role, GroupSet groupset)
Checks if the user is assigned a specific Role in any of the given Groups- Specified by:
hasRolein interfaceDynamicAccessControlList- Parameters:
role- the Rolegroupset- a Groupset- Returns:
trueif the user is assigned the Role in any of the given Groups.
-
hasRole
public boolean hasRole(String role, String group)
Checks if the user is assigned a specific Role in the Group.- Specified by:
hasRolein interfaceDynamicAccessControlList- Parameters:
role- the Rolegroup- the Group- Returns:
trueif the user is assigned the Role in the Group.
-
hasRole
public boolean hasRole(String rolename, GroupSet groupset)
Checks if the user is assigned a specific Role in any of the given Groups- Specified by:
hasRolein interfaceDynamicAccessControlList- Parameters:
rolename- the name of the Rolegroupset- a Groupset- Returns:
trueif the user is assigned the Role in any of the given Groups.
-
hasRole
public boolean hasRole(Role role)
Checks if the user is assigned a specific Role- Specified by:
hasRolein interfaceDynamicAccessControlList- Parameters:
role- the Role- Returns:
trueif the user is assigned the Role in the global Group.
-
hasRole
public boolean hasRole(String role)
Checks if the user is assigned a specific Role .- Specified by:
hasRolein interfaceDynamicAccessControlList- Parameters:
role- the Role- Returns:
trueif the user is assigned the Role .
-
hasPermission
public boolean hasPermission(Permission permission, Group group)
Checks if the user is assigned a specific Permission in the Group.- Specified by:
hasPermissionin interfaceDynamicAccessControlList- Parameters:
permission- the Permissiongroup- the Group- Returns:
trueif the user is assigned the Permission in the Group.
-
hasPermission
public boolean hasPermission(Permission permission, GroupSet groupset)
Checks if the user is assigned a specific Permission in any of the given Groups- Specified by:
hasPermissionin interfaceDynamicAccessControlList- Parameters:
permission- the Permissiongroupset- a Groupset- Returns:
trueif the user is assigned the Permission in any of the given Groups.
-
hasPermission
public boolean hasPermission(String permission, String group)
Checks if the user is assigned a specific Permission in the Group.- Specified by:
hasPermissionin interfaceDynamicAccessControlList- Parameters:
permission- the Permissiongroup- the Group- Returns:
trueif the user is assigned the Permission in the Group.
-
hasPermission
public boolean hasPermission(String permission, Group group)
Checks if the user is assigned a specific Permission in the Group.- Specified by:
hasPermissionin interfaceDynamicAccessControlList- Parameters:
permission- the Permissiongroup- the Group- Returns:
trueif the user is assigned the Permission in the Group.
-
hasPermission
public boolean hasPermission(String permissionName, GroupSet groupset)
Checks if the user is assigned a specific Permission in any of the given Groups- Specified by:
hasPermissionin interfaceDynamicAccessControlList- Parameters:
permissionName- the name of the Permissiongroupset- a Groupset- Returns:
trueif the user is assigned the Permission in any of the given Groups.
-
hasPermission
public boolean hasPermission(Permission permission)
Checks if the user is assigned a specific Permission.- Specified by:
hasPermissionin interfaceDynamicAccessControlList- Parameters:
permission- the Permission- Returns:
trueif the user is assigned the Permission .
-
hasPermission
public boolean hasPermission(String permission)
Checks if the user is assigned a specific Permission in the global Group.- Specified by:
hasPermissionin interfaceDynamicAccessControlList- Parameters:
permission- the Permission- Returns:
trueif the user is assigned the Permission in the global Group.
-
-