Package com.hybris.backoffice.user
Class DefaultBackofficeRoleService
java.lang.Object
com.hybris.backoffice.user.DefaultBackofficeRoleService
- All Implemented Interfaces:
BackofficeRoleService
Default implementation of
BackofficeRoleService.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfilterOutRolePrincipals(Collection<PrincipalGroupModel> principals) Filters out the roles from the given collection of principal groups.Returns an optional id of the active backoffice role or an empty optional if no role is active.Returns an optional of the active backoffice role or an empty optional if no role is active.Returns user groups hierarchy of the active backoffice role (including the role) or an empty collection if there is no active role.getNonRolePrincipalsHierarchy(PrincipalModel principal) Returns principal's user groups hierarchy with the exclusion of backoffice roles and their hierarchies.protected SessionServiceprotected UserServicebooleanisActiveRole(String roleId) Tells whether the role with a given id is the current active role.voidsetActiveRole(String roleId) Sets the active backoffice role in the session.voidsetSessionService(SessionService sessionService) voidsetUserService(UserService userService) booleanTells whether backoffice roles should be treated like normal user groups (legacy mode).
-
Constructor Details
-
DefaultBackofficeRoleService
public DefaultBackofficeRoleService()
-
-
Method Details
-
shouldTreatRolesAsGroups
public boolean shouldTreatRolesAsGroups()Description copied from interface:BackofficeRoleServiceTells whether backoffice roles should be treated like normal user groups (legacy mode).- Specified by:
shouldTreatRolesAsGroupsin interfaceBackofficeRoleService- Returns:
trueif legacy mode should be used and roles should be treated equal to groups
-
getActiveRoleModel
Description copied from interface:BackofficeRoleServiceReturns an optional of the active backoffice role or an empty optional if no role is active.- Specified by:
getActiveRoleModelin interfaceBackofficeRoleService- Returns:
- model of active role
-
getActiveRole
Description copied from interface:BackofficeRoleServiceReturns an optional id of the active backoffice role or an empty optional if no role is active.- Specified by:
getActiveRolein interfaceBackofficeRoleService- Returns:
GeneratedPrincipal.UIDof active role
-
setActiveRole
Description copied from interface:BackofficeRoleServiceSets the active backoffice role in the session. Passing anullor an empty value will remove the attribute from the session.- Specified by:
setActiveRolein interfaceBackofficeRoleService- Parameters:
roleId- {@link BackofficeRole@UID} of new active role
-
isActiveRole
Description copied from interface:BackofficeRoleServiceTells whether the role with a given id is the current active role.- Specified by:
isActiveRolein interfaceBackofficeRoleService- Parameters:
roleId- the role id to check- Returns:
- true if the id belongs to the current active role, false otherwise
-
getActiveRolePrincipalsHierarchy
Description copied from interface:BackofficeRoleServiceReturns user groups hierarchy of the active backoffice role (including the role) or an empty collection if there is no active role.- Specified by:
getActiveRolePrincipalsHierarchyin interfaceBackofficeRoleService- Returns:
- a collection of all subgroups of active role including this role or empty collection if no active role
-
getNonRolePrincipalsHierarchy
Description copied from interface:BackofficeRoleServiceReturns principal's user groups hierarchy with the exclusion of backoffice roles and their hierarchies. The returned collection is never empty, as it contains at least theprincipalitself.- Specified by:
getNonRolePrincipalsHierarchyin interfaceBackofficeRoleService- Parameters:
principal- principal from which the hierarchy is taken- Returns:
- a collection of active all subgroups that principal belongs to without those that are backoffice roles or comes from them and this principal
-
filterOutRolePrincipals
public Collection<PrincipalGroupModel> filterOutRolePrincipals(Collection<PrincipalGroupModel> principals) Description copied from interface:BackofficeRoleServiceFilters out the roles from the given collection of principal groups.- Specified by:
filterOutRolePrincipalsin interfaceBackofficeRoleService- Parameters:
principals- the collection to filter- Returns:
- a new collection, without the roles
-
getSessionService
-
setSessionService
-
getUserService
-
setUserService
-