Package org.uberfire.security.impl.authz
Class DefaultAuthorizationPolicy
- java.lang.Object
-
- org.uberfire.security.impl.authz.DefaultAuthorizationPolicy
-
- All Implemented Interfaces:
AuthorizationPolicy
@Portable public class DefaultAuthorizationPolicy extends Object implements AuthorizationPolicy
-
-
Constructor Summary
Constructors Constructor Description DefaultAuthorizationPolicy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPermission(org.jboss.errai.security.shared.api.Group group, Permission permission)Add a single permission entry for a group.voidaddPermission(org.jboss.errai.security.shared.api.Role role, Permission permission)voidaddPermission(Permission permission)protected DefaultAuthorizationEntrygetAuthzEntry(org.jboss.errai.security.shared.api.Group group)protected DefaultAuthorizationEntrygetAuthzEntry(org.jboss.errai.security.shared.api.Role role)StringgetGroupDescription(org.jboss.errai.security.shared.api.Group group)Get the description of an existing group.Set<org.jboss.errai.security.shared.api.Group>getGroups()Get the collection of groups this policy is related to.StringgetHomePerspective()Gets the identifier of the default home perspective.StringgetHomePerspective(org.jboss.errai.security.shared.api.Group group)Get the identifier of the home perspective assigned to the given group.StringgetHomePerspective(org.jboss.errai.security.shared.api.identity.User user)Get the identifier of the perspective this user is redirected by default.StringgetHomePerspective(org.jboss.errai.security.shared.api.Role role)Get the identifier of the home perspective assigned to the given group.PermissionCollectiongetPermissions()Get the default permissions.PermissionCollectiongetPermissions(org.jboss.errai.security.shared.api.Group group)Get the permissions assigned to a given group.PermissionCollectiongetPermissions(org.jboss.errai.security.shared.api.Role role)Get the permissions assigned to a given role.intgetPriority(org.jboss.errai.security.shared.api.Group group)Get a group's priority.intgetPriority(org.jboss.errai.security.shared.api.Role role)Get a role's priority.StringgetRoleDescription(org.jboss.errai.security.shared.api.Role role)Get the description of an existing role.Set<org.jboss.errai.security.shared.api.Role>getRoles()Get the collection of roles this policy is related to.protected DefaultAuthorizationEntryregisterAuthzEntry(DefaultAuthorizationEntry entry)voidsetGroupDescription(org.jboss.errai.security.shared.api.Group group, String description)Sets a description for an existing group.voidsetHomePerspective(String perspectiveId)Sets the identifier of the default home perspective.voidsetHomePerspective(org.jboss.errai.security.shared.api.Group group, String perspective)Set the identifier of the home perspective assigned to the given group.voidsetHomePerspective(org.jboss.errai.security.shared.api.Role role, String perspective)Set the identifier of the home perspective assigned to the given role.voidsetPermissions(org.jboss.errai.security.shared.api.Group group, PermissionCollection collection)Set the group's permissionsvoidsetPermissions(org.jboss.errai.security.shared.api.Role role, PermissionCollection collection)Set the role's permissionsvoidsetPriority(org.jboss.errai.security.shared.api.Group group, int priority)Set the group's priorityvoidsetPriority(org.jboss.errai.security.shared.api.Role role, int priority)Set the role's priorityvoidsetRoleDescription(org.jboss.errai.security.shared.api.Role role, String description)Sets a description for an existing role.StringtoString()
-
-
-
Method Detail
-
registerAuthzEntry
protected DefaultAuthorizationEntry registerAuthzEntry(DefaultAuthorizationEntry entry)
-
getAuthzEntry
protected DefaultAuthorizationEntry getAuthzEntry(org.jboss.errai.security.shared.api.Role role)
-
getAuthzEntry
protected DefaultAuthorizationEntry getAuthzEntry(org.jboss.errai.security.shared.api.Group group)
-
getRoles
public Set<org.jboss.errai.security.shared.api.Role> getRoles()
Description copied from interface:AuthorizationPolicyGet the collection of roles this policy is related to.- Specified by:
getRolesin interfaceAuthorizationPolicy
-
getGroups
public Set<org.jboss.errai.security.shared.api.Group> getGroups()
Description copied from interface:AuthorizationPolicyGet the collection of groups this policy is related to.- Specified by:
getGroupsin interfaceAuthorizationPolicy
-
getRoleDescription
public String getRoleDescription(org.jboss.errai.security.shared.api.Role role)
Description copied from interface:AuthorizationPolicyGet the description of an existing role.- Specified by:
getRoleDescriptionin interfaceAuthorizationPolicy- Parameters:
role- The role- Returns:
- The role description
-
setRoleDescription
public void setRoleDescription(org.jboss.errai.security.shared.api.Role role, String description)Description copied from interface:AuthorizationPolicySets a description for an existing role.- Specified by:
setRoleDescriptionin interfaceAuthorizationPolicy- Parameters:
role- The roledescription- A non empty description
-
getGroupDescription
public String getGroupDescription(org.jboss.errai.security.shared.api.Group group)
Description copied from interface:AuthorizationPolicyGet the description of an existing group.- Specified by:
getGroupDescriptionin interfaceAuthorizationPolicy- Parameters:
group- The group- Returns:
- The group description
-
setGroupDescription
public void setGroupDescription(org.jboss.errai.security.shared.api.Group group, String description)Description copied from interface:AuthorizationPolicySets a description for an existing group.- Specified by:
setGroupDescriptionin interfaceAuthorizationPolicy- Parameters:
group- The group identifierdescription- A non empty description
-
getPriority
public int getPriority(org.jboss.errai.security.shared.api.Role role)
Description copied from interface:AuthorizationPolicyGet a role's priority. The priority is important during permission resolution and when a user is assigned to more than one role/group it is used to determine what is the most priority.- Specified by:
getPriorityin interfaceAuthorizationPolicy- Parameters:
role- The role instance- Returns:
- An integer. The highest, the more priority the collection is. Default priority value is 0.
-
getPriority
public int getPriority(org.jboss.errai.security.shared.api.Group group)
Description copied from interface:AuthorizationPolicyGet a group's priority. The priority is important during permission resolution and when a user is assigned to more than one role/group it is used to determine what is the most priority.- Specified by:
getPriorityin interfaceAuthorizationPolicy- Parameters:
group- The group instance- Returns:
- An integer. The highest, the more priority the collection is. Default priority value is 0.
-
setPriority
public void setPriority(org.jboss.errai.security.shared.api.Role role, int priority)Description copied from interface:AuthorizationPolicySet the role's priority- Specified by:
setPriorityin interfaceAuthorizationPolicy- Parameters:
role- The role instancepriority- Any valid integer. The highest, the more priority the role is.
-
setPriority
public void setPriority(org.jboss.errai.security.shared.api.Group group, int priority)Description copied from interface:AuthorizationPolicySet the group's priority- Specified by:
setPriorityin interfaceAuthorizationPolicy- Parameters:
group- The group instancepriority- Any valid integer. The highest, the more priority the role is.
-
getPermissions
public PermissionCollection getPermissions(org.jboss.errai.security.shared.api.Role role)
Description copied from interface:AuthorizationPolicyGet the permissions assigned to a given role.- Specified by:
getPermissionsin interfaceAuthorizationPolicy- Parameters:
role- The role instance- Returns:
- The permission collection. Notice, the default permission collection is also included in the results.
-
getPermissions
public PermissionCollection getPermissions(org.jboss.errai.security.shared.api.Group group)
Description copied from interface:AuthorizationPolicyGet the permissions assigned to a given group.- Specified by:
getPermissionsin interfaceAuthorizationPolicy- Parameters:
group- The group instance- Returns:
- The permission collection. Notice, the default permission collection is also included in the results.
-
addPermission
public void addPermission(Permission permission)
-
addPermission
public void addPermission(org.jboss.errai.security.shared.api.Role role, Permission permission)
-
addPermission
public void addPermission(org.jboss.errai.security.shared.api.Group group, Permission permission)Description copied from interface:AuthorizationPolicyAdd a single permission entry for a group.- Specified by:
addPermissionin interfaceAuthorizationPolicy- Parameters:
group- The group instancepermission- A permission instance
-
setPermissions
public void setPermissions(org.jboss.errai.security.shared.api.Role role, PermissionCollection collection)Description copied from interface:AuthorizationPolicySet the role's permissions- Specified by:
setPermissionsin interfaceAuthorizationPolicy- Parameters:
role- The role instancecollection- A permission collection
-
setPermissions
public void setPermissions(org.jboss.errai.security.shared.api.Group group, PermissionCollection collection)Description copied from interface:AuthorizationPolicySet the group's permissions- Specified by:
setPermissionsin interfaceAuthorizationPolicy- Parameters:
group- The group instancecollection- A permission collection
-
setHomePerspective
public void setHomePerspective(org.jboss.errai.security.shared.api.Role role, String perspective)Description copied from interface:AuthorizationPolicySet the identifier of the home perspective assigned to the given role.- Specified by:
setHomePerspectivein interfaceAuthorizationPolicy- Parameters:
role- The target role instanceperspective- An existing perspective identifier
-
setHomePerspective
public void setHomePerspective(org.jboss.errai.security.shared.api.Group group, String perspective)Description copied from interface:AuthorizationPolicySet the identifier of the home perspective assigned to the given group.- Specified by:
setHomePerspectivein interfaceAuthorizationPolicy- Parameters:
group- The target group instanceperspective- An existing perspective identifier
-
getHomePerspective
public String getHomePerspective(org.jboss.errai.security.shared.api.Role role)
Description copied from interface:AuthorizationPolicyGet the identifier of the home perspective assigned to the given group.- Specified by:
getHomePerspectivein interfaceAuthorizationPolicy- Returns:
- An existing perspective identifier
-
getHomePerspective
public String getHomePerspective(org.jboss.errai.security.shared.api.Group group)
Description copied from interface:AuthorizationPolicyGet the identifier of the home perspective assigned to the given group.- Specified by:
getHomePerspectivein interfaceAuthorizationPolicy- Returns:
- An existing perspective identifier
-
getHomePerspective
public String getHomePerspective(org.jboss.errai.security.shared.api.identity.User user)
Description copied from interface:AuthorizationPolicyGet the identifier of the perspective this user is redirected by default.If the user is assigned with more than one role or group then the most priority one is taken.
- Specified by:
getHomePerspectivein interfaceAuthorizationPolicy- Returns:
- An existing perspective identifier
- See Also:
AuthorizationPolicy.getPriority(Role),AuthorizationPolicy.getPriority(Group)
-
getHomePerspective
public String getHomePerspective()
Description copied from interface:AuthorizationPolicyGets the identifier of the default home perspective.This is the perspective that is returned for those roles/groups with no home perspective set.
- Specified by:
getHomePerspectivein interfaceAuthorizationPolicy- Returns:
- An existing perspective identifier
-
setHomePerspective
public void setHomePerspective(String perspectiveId)
Description copied from interface:AuthorizationPolicySets the identifier of the default home perspective.This is the perspective that is returned for those roles/groups with no gome perspective set.
- Specified by:
setHomePerspectivein interfaceAuthorizationPolicy- Parameters:
perspectiveId- An existing perspective identifier
-
getPermissions
public PermissionCollection getPermissions()
Description copied from interface:AuthorizationPolicyGet the default permissions.These are he permissions that are returned for those roles/groups with no permissions set.
- Specified by:
getPermissionsin interfaceAuthorizationPolicy- Returns:
- The permission collection
-
-