@Component(value="cuba_RolesHelper")
public class RolesHelper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected DataManager |
dataManager |
protected Metadata |
metadata |
protected PredefinedRoleDefinitionRepository |
predefinedRoleDefinitionRepository |
protected ServerConfig |
serverConfig |
Constructor and Description |
---|
RolesHelper() |
Modifier and Type | Method and Description |
---|---|
protected void |
fillWildcardPermissionsByRoleType(BasicRoleDefinition.BasicRoleDefinitionBuilder builder,
RoleType roleType) |
java.util.Collection<Role> |
getDefaultRoles() |
java.util.Collection<Role> |
getDefaultRoles(EntityManager em) |
Access |
getPermissionUndefinedAccessPolicy()
Defines a policy for resolving permission values that are not defined in roles.
|
java.util.Collection<RoleDefinition> |
getRoleDefinitionsForUser(User user,
boolean reloadUser)
Returns a collection of
RoleDefinition objects assigned to the User . |
java.util.Collection<Permission> |
transformToPermissionsCollection(PermissionsContainer permissionsContainer,
PermissionType type,
Role role) |
Role |
transformToRole(RoleDefinition roleDefinition,
RoleTransformationOption... transformationOptions) |
RoleDefinition |
transformToRoleDefinition(Role role) |
@Inject protected ServerConfig serverConfig
@Inject protected PredefinedRoleDefinitionRepository predefinedRoleDefinitionRepository
@Inject protected DataManager dataManager
@Inject protected Metadata metadata
public java.util.Collection<Role> getDefaultRoles()
public java.util.Collection<Role> getDefaultRoles(@Nullable EntityManager em)
public java.util.Collection<RoleDefinition> getRoleDefinitionsForUser(User user, boolean reloadUser)
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
user
- the userreloadUser
- if set to true then the passed user
will be reloaded with the proper view (contains
roles with permissions). If the parameter value is false then this check won't be performed.
Set the parameter to false when the method is invoked from within the opened transaction (i.e.
from the UserSessionManager
) - in this case all
non-loaded fields will be fetched when they are accessed within the method.RoleDefinition
objectspublic Role transformToRole(RoleDefinition roleDefinition, RoleTransformationOption... transformationOptions)
public java.util.Collection<Permission> transformToPermissionsCollection(PermissionsContainer permissionsContainer, PermissionType type, Role role)
public RoleDefinition transformToRoleDefinition(Role role)
public Access getPermissionUndefinedAccessPolicy()
For new v2 security mechanism the undefined permission should be resolved as denied.
protected void fillWildcardPermissionsByRoleType(BasicRoleDefinition.BasicRoleDefinitionBuilder builder, @Nullable RoleType roleType)