Class DefaultAuthorityGroupContextStrategy
- java.lang.Object
-
- com.hybris.cockpitng.core.config.impl.DefaultAuthorityGroupContextStrategy
-
- All Implemented Interfaces:
CockpitConfigurationContextStrategy
- Direct Known Subclasses:
DefaultAuthorityContextStrategy
public class DefaultAuthorityGroupContextStrategy extends java.lang.Object implements CockpitConfigurationContextStrategy
Gets the current selected authority group as parent context for a user. You can use comma separated list of principals such as "admin,inventorymanager,inventoryuser". This strategy will match any of them.
-
-
Field Summary
-
Fields inherited from interface com.hybris.cockpitng.core.config.CockpitConfigurationContextStrategy
EMPTY_PARENT_CONTEXT
-
-
Constructor Summary
Constructors Constructor Description DefaultAuthorityGroupContextStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringextractAuthorityGroup(java.lang.String context)protected java.lang.StringextractUser(java.lang.String context)protected AuthorityGroupServicegetAuthorityGroupService()protected CockpitUserServicegetCockpitUserService()ConfigContextgetConfigurationCacheKey(ConfigContext configContext)Wraps provided ConfigContext, adds some attributes to make the configuration context more specific and returns it.protected java.util.List<java.lang.String>getParentContexts(AuthorityGroup authorityGroup, java.lang.String currentUser, java.lang.String principal)java.util.List<java.lang.String>getParentContexts(java.lang.String context)Gets parent values for provided one.protected java.util.List<java.lang.String>getPrincipals(java.lang.String contextValue)protected java.lang.StringgetStamp(java.lang.String context)protected java.lang.StringgetStamp(java.lang.String context, java.lang.String type)protected java.lang.StringgetStamp(java.lang.String context, java.util.function.Predicate<java.lang.String> test)protected java.util.regex.PatterngetStampedValuePattern()protected booleanhasParentContexts(AuthorityGroup authorityGroup, java.lang.String currentUser, java.lang.String principal)booleanisResettable()Checks if value of strategy's attribute should be reset up to original value after match.protected booleanisStamped(java.lang.String context)protected java.lang.StringremoveStamp(java.lang.String context)protected java.lang.StringremoveStamp(java.lang.String context, java.lang.String type)protected java.lang.StringremoveStamp(java.lang.String context, java.util.function.Predicate<java.lang.String> test)voidsetAuthorityGroupService(AuthorityGroupService authorityGroupService)voidsetCockpitUserService(CockpitUserService cockpitUserService)protected booleansingleValueMatches(java.lang.String contextValue, java.lang.String value)protected java.lang.StringstampParentValue(java.lang.String value, java.lang.String stamp)booleanvalueMatches(java.lang.String contextValue, java.lang.String value)Checks if provided value matches the one defined in configuration context.
-
-
-
Method Detail
-
isResettable
public boolean isResettable()
Description copied from interface:CockpitConfigurationContextStrategyChecks if value of strategy's attribute should be reset up to original value after match.Search algorithm after a match looks for parent contexts. There is a possibility, that some of attributes should be reset to original value before looking for parents (i.e. module).
- Specified by:
isResettablein interfaceCockpitConfigurationContextStrategy- Returns:
trueif value should be reset
-
getParentContexts
public java.util.List<java.lang.String> getParentContexts(java.lang.String context)
Description copied from interface:CockpitConfigurationContextStrategyGets parent values for provided one.- Specified by:
getParentContextsin interfaceCockpitConfigurationContextStrategy- Parameters:
context- value which parent is requested- Returns:
- list of parent values
-
hasParentContexts
protected boolean hasParentContexts(AuthorityGroup authorityGroup, java.lang.String currentUser, java.lang.String principal)
-
isStamped
protected boolean isStamped(java.lang.String context)
-
extractAuthorityGroup
protected java.lang.String extractAuthorityGroup(java.lang.String context)
-
extractUser
protected java.lang.String extractUser(java.lang.String context)
-
removeStamp
protected java.lang.String removeStamp(java.lang.String context)
-
removeStamp
protected java.lang.String removeStamp(java.lang.String context, java.lang.String type)
-
removeStamp
protected java.lang.String removeStamp(java.lang.String context, java.util.function.Predicate<java.lang.String> test)
-
getStamp
protected java.lang.String getStamp(java.lang.String context)
-
getStamp
protected java.lang.String getStamp(java.lang.String context, java.lang.String type)
-
getStamp
protected java.lang.String getStamp(java.lang.String context, java.util.function.Predicate<java.lang.String> test)
-
getStampedValuePattern
protected java.util.regex.Pattern getStampedValuePattern()
-
getParentContexts
protected java.util.List<java.lang.String> getParentContexts(AuthorityGroup authorityGroup, java.lang.String currentUser, java.lang.String principal)
-
stampParentValue
protected java.lang.String stampParentValue(java.lang.String value, java.lang.String stamp)
-
getConfigurationCacheKey
public ConfigContext getConfigurationCacheKey(ConfigContext configContext)
Description copied from interface:CockpitConfigurationContextStrategyWraps provided ConfigContext, adds some attributes to make the configuration context more specific and returns it.- Specified by:
getConfigurationCacheKeyin interfaceCockpitConfigurationContextStrategy- Parameters:
configContext- source- Returns:
- wrapped configContext
-
valueMatches
public boolean valueMatches(java.lang.String contextValue, java.lang.String value)Description copied from interface:CockpitConfigurationContextStrategyChecks if provided value matches the one defined in configuration context.- Specified by:
valueMatchesin interfaceCockpitConfigurationContextStrategy- Parameters:
contextValue- value defined in configuration contextvalue- value to be checked- Returns:
trueif provided value matches the one defined in configuration context
-
getPrincipals
protected java.util.List<java.lang.String> getPrincipals(java.lang.String contextValue)
-
singleValueMatches
protected boolean singleValueMatches(java.lang.String contextValue, java.lang.String value)
-
getAuthorityGroupService
protected AuthorityGroupService getAuthorityGroupService()
-
setAuthorityGroupService
public void setAuthorityGroupService(AuthorityGroupService authorityGroupService)
-
getCockpitUserService
protected CockpitUserService getCockpitUserService()
-
setCockpitUserService
public void setCockpitUserService(CockpitUserService cockpitUserService)
-
-