Package com.hybris.backoffice.user
Class DefaultBackofficeRoleService
- java.lang.Object
-
- com.hybris.backoffice.user.DefaultBackofficeRoleService
-
- All Implemented Interfaces:
BackofficeRoleService
public class DefaultBackofficeRoleService extends java.lang.Object implements BackofficeRoleService
Default implementation ofBackofficeRoleService.
-
-
Constructor Summary
Constructors Constructor Description DefaultBackofficeRoleService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Collection<PrincipalGroupModel>filterOutRolePrincipals(java.util.Collection<PrincipalGroupModel> principals)Filters out the roles from the given collection of principal groups.java.util.Optional<java.lang.String>getActiveRole()Returns an optional id of the active backoffice role or an empty optional if no role is active.java.util.Optional<BackofficeRoleModel>getActiveRoleModel()Returns an optional of the active backoffice role or an empty optional if no role is active.java.util.Collection<PrincipalGroupModel>getActiveRolePrincipalsHierarchy()Returns user groups hierarchy of the active backoffice role (including the role) or an empty collection if there is no active role.java.util.Collection<PrincipalModel>getNonRolePrincipalsHierarchy(PrincipalModel principal)Returns principal's user groups hierarchy with the exclusion of backoffice roles and their hierarchies.protected SessionServicegetSessionService()protected UserServicegetUserService()booleanisActiveRole(java.lang.String roleId)Tells whether the role with a given id is the current active role.voidsetActiveRole(java.lang.String roleId)Sets the active backoffice role in the session.voidsetSessionService(SessionService sessionService)voidsetUserService(UserService userService)booleanshouldTreatRolesAsGroups()Tells whether backoffice roles should be treated like normal user groups (legacy mode).
-
-
-
Method Detail
-
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
public java.util.Optional<BackofficeRoleModel> 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
public java.util.Optional<java.lang.String> 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
public void setActiveRole(java.lang.String roleId)
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
public boolean isActiveRole(java.lang.String roleId)
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
public java.util.Collection<PrincipalGroupModel> 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
public java.util.Collection<PrincipalModel> getNonRolePrincipalsHierarchy(PrincipalModel principal)
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 java.util.Collection<PrincipalGroupModel> filterOutRolePrincipals(java.util.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
protected SessionService getSessionService()
-
setSessionService
public void setSessionService(SessionService sessionService)
-
getUserService
protected UserService getUserService()
-
setUserService
public void setUserService(UserService userService)
-
-