public interface RolesService
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME |
Modifier and Type | Method and Description |
---|---|
java.util.Collection<Role> |
getAllRoles()
Returns a collection of all roles (
Role objects) available in the application (SecurityStorageMode is taken into account). |
java.util.Collection<Role> |
getDefaultRoles()
Returns all roles marked as default (both from the database and from the source code).
|
java.util.Collection<Permission> |
getPermissions(java.lang.String predefinedRoleName,
PermissionType permissionType)
Finds a predefined role definition by the name and builds a collection of
Permission objects that has a
given permissionType . |
Access |
getPermissionUndefinedAccessPolicy()
Returns a policy for resolving permission values that are not explicitly defined in roles.
|
Role |
getRoleDefinitionAndTransformToRole(java.lang.String roleDefinitionName)
Finds the predefined role definition by the name and converts it to the
Role object. |
RoleDefinition |
getRoleDefinitionByName(java.lang.String name) |
java.util.Collection<RoleDefinition> |
getRoleDefinitionsForUser(User user)
Returns a collection of
RoleDefinition objects assigned to the User . |
java.util.Collection<Role> |
getRolesForUser(User user)
Returns a collection of
Role objects assigned to the User . |
int |
getRolesPolicyVersion()
Returns the roles policy version.
|
boolean |
isRoleStorageMixedMode() |
Role |
transformToRole(RoleDefinition roleDefinition,
RoleTransformationOption... transformationOptions)
Transforms the given
roleDefinition to the Role object. |
static final java.lang.String NAME
java.util.Collection<Role> getAllRoles()
Role
objects) available in the application (SecurityStorageMode
is taken into account). If there are predefined roles (RoleDefinition
objects in the
source code), they will be converted to Role
and will also be returned in the result collection. The
resulting roles permissions collections are not filled.Role
objects) available in the application.@Nullable RoleDefinition getRoleDefinitionByName(java.lang.String name)
@Nullable Role getRoleDefinitionAndTransformToRole(java.lang.String roleDefinitionName)
Role
object.roleDefinitionName
- name of a predefined roleRole
object that contains all permissions of a predefined role or null if role definition is not
found.Role transformToRole(RoleDefinition roleDefinition, RoleTransformationOption... transformationOptions)
roleDefinition
to the Role
object. By default, all permissions will also be
transformed, if you don't need them in the resulting role, use the RoleTransformationOption.DO_NOT_INCLUDE_PERMISSIONS
option.java.util.Collection<Permission> getPermissions(java.lang.String predefinedRoleName, PermissionType permissionType)
Permission
objects that has a
given permissionType
.predefinedRoleName
- name of a predefined rolepermissionType
- type of permissions that should be returnedPermission
objects or an empty collection if the predefined role doesn't existboolean isRoleStorageMixedMode()
true
if roles are stored in a source code and in a database, false
otherwise. See SecurityStorageMode
java.util.Collection<Role> getDefaultRoles()
java.util.Collection<Role> getRolesForUser(User user)
Role
objects assigned to the User
. If the user role is associated with a
predefined role definition, the predefined role will be converted to the Role
Role
objectsjava.util.Collection<RoleDefinition> getRoleDefinitionsForUser(User user)
RoleDefinition
objects assigned to the User
. If the user role is
associated with the database role, the database role will be converted to the RoleDefinition
RoleDefinition
objectsAccess getPermissionUndefinedAccessPolicy()
getRolesPolicyVersion()
if a role doesn't define any explicit permission then this target is allowed,
for policy v2 the undefined permission is denied.int getRolesPolicyVersion()