public class SimpleRole extends AAAObjectBase implements Role
A simple and immutable Privilege implementation.
This implementation use internal data structure to store the permissions granted to the role. Sub class might choose to rely on AuthorizationService.getPermissions(org.osgl.aaa.Role, org.osgl.aaa.AAAContext) to get permissions associated to the role
| Modifier and Type | Class and Description |
|---|---|
static class |
SimpleRole.Builder |
| Modifier | Constructor and Description |
|---|---|
protected |
SimpleRole()
This constructor is designed to be used by tools like ORM to deserialize the object from a certain persistent storage
|
|
SimpleRole(String name,
List<? extends Permission> perms)
Construct a role by name and given list of permissions
|
| Modifier and Type | Method and Description |
|---|---|
List<Permission> |
getPermissions()
Returns a list of permissions associated with this role.
|
boolean |
hasPermission(Permission permission)
Check if the role contains a permission.
|
equals, getName, getProperty, hashCode, propertyKeys, setProperty, toString, unsetPropertyclone, finalize, getClass, notify, notifyAll, wait, wait, waitequals, getName, getProperty, hashCode, propertyKeys, setProperty, toString, unsetPropertyprotected SimpleRole()
This constructor is designed to be used by tools like ORM to deserialize the object from a certain persistent storage
public SimpleRole(String name, List<? extends Permission> perms)
Construct a role by name and given list of permissions
name - the nameperms - the permissionspublic List<Permission> getPermissions()
RoleReturns a list of permissions associated with this role.
Note the result of the method shall comply to the result of
AuthorizationService.getPermissions(Role, AAAContext)
It is up to the implementation to decide the dependency relationship
between the two
getPermissions in interface Rolepublic boolean hasPermission(Permission permission)
RoleCheck if the role contains a permission. Calling this method shall be equals to calling getPermissions().contains(permission)
hasPermission in interface Rolepermission - permissiontrue if the role has the permission or false otherwiseCopyright © 2017–2020 OSGL (Open Source General Library). All rights reserved.