@Service(value="cuba_RolesService") public class RolesServiceBean extends java.lang.Object implements RolesService
| Modifier and Type | Field and Description |
|---|---|
protected DataManager |
dataManager |
protected EntityStates |
entityStates |
protected GlobalConfig |
globalConfig |
protected org.slf4j.Logger |
log |
protected Metadata |
metadata |
protected PersistenceSecurity |
persistenceSecurity |
protected PredefinedRoleDefinitionRepository |
predefinedRoleDefinitionRepository |
protected RolesHelper |
rolesHelper |
protected ServerConfig |
serverConfig |
NAME| Constructor and Description |
|---|
RolesServiceBean() |
| 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. |
@Inject protected DataManager dataManager
@Inject protected GlobalConfig globalConfig
@Inject protected PersistenceSecurity persistenceSecurity
@Inject protected org.slf4j.Logger log
@Inject protected ServerConfig serverConfig
@Inject protected PredefinedRoleDefinitionRepository predefinedRoleDefinitionRepository
@Inject protected Metadata metadata
@Inject protected RolesHelper rolesHelper
@Inject protected EntityStates entityStates
public java.util.Collection<Role> getAllRoles()
RolesServiceRole 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.getAllRoles in interface RolesServiceRole objects) available in the application.@Nullable public RoleDefinition getRoleDefinitionByName(java.lang.String name)
getRoleDefinitionByName in interface RolesServicepublic Role getRoleDefinitionAndTransformToRole(java.lang.String roleDefinitionName)
RolesServiceRole object.getRoleDefinitionAndTransformToRole in interface RolesServiceroleDefinitionName - name of a predefined roleRole object that contains all permissions of a predefined role or null if role definition is not
found.public boolean isRoleStorageMixedMode()
isRoleStorageMixedMode in interface RolesServicetrue if roles are stored in a source code and in a database, false otherwise. See SecurityStorageModepublic java.util.Collection<Role> getDefaultRoles()
RolesServicegetDefaultRoles in interface RolesServicepublic Role transformToRole(RoleDefinition roleDefinition, RoleTransformationOption... transformationOptions)
RolesServiceroleDefinition 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.transformToRole in interface RolesServicepublic java.util.Collection<Permission> getPermissions(java.lang.String predefinedRoleName, PermissionType permissionType)
RolesServicePermission objects that has a
given permissionType.getPermissions in interface RolesServicepredefinedRoleName - name of a predefined rolepermissionType - type of permissions that should be returnedPermission objects or an empty collection if the predefined role doesn't existpublic java.util.Collection<Role> getRolesForUser(User user)
RolesServiceRole objects assigned to the User. If the user role is associated with a
predefined role definition, the predefined role will be converted to the RolegetRolesForUser in interface RolesServiceRole objectspublic java.util.Collection<RoleDefinition> getRoleDefinitionsForUser(User user)
RolesServiceRoleDefinition objects assigned to the User. If the user role is
associated with the database role, the database role will be converted to the RoleDefinitiongetRoleDefinitionsForUser in interface RolesServiceRoleDefinition objectspublic Access getPermissionUndefinedAccessPolicy()
RolesServiceRolesService.getRolesPolicyVersion() if a role doesn't define any explicit permission then this target is allowed,
for policy v2 the undefined permission is denied.getPermissionUndefinedAccessPolicy in interface RolesServicepublic int getRolesPolicyVersion()
RolesServicegetRolesPolicyVersion in interface RolesService