Class SiteChannelRestrictionAspect
java.lang.Object
de.hybris.platform.commercewebservicescommons.annotation.SiteChannelRestrictionAspect
Aspect implementation for restricting an annotated OCC endpoint based on site channel
-
Constructor Summary
ConstructorsConstructorDescriptionSiteChannelRestrictionAspect(BaseSiteService baseSiteService, ConfigurationService configurationService) -
Method Summary
Modifier and TypeMethodDescriptionprotected BaseSiteServiceprotected ConfigurationServiceprotected MethodgetMethod(org.aspectj.lang.ProceedingJoinPoint proceedingJoinPoint) Returns the intercepted method annotated withSiteChannelRestrictionprotected String[]Gets method allowed site channels value based onSiteChannelRestrictionannotation.protected booleanisBaseSiteAllowed(BaseSiteModel baseSite, Method method) Checks if the site channel of a base site is an allowed site channelprotected booleanisSiteChannelAllowed(SiteChannel siteChannel, Method method) Checks if the given site channel is an allowed site channelvalidateSiteChannel(org.aspectj.lang.ProceedingJoinPoint proceedingJoinPoint) Logic of the pointcut for restricting an OCC endpoint annotated withSiteChannelRestrictionbased on site channel, throwsAccessDeniedExceptionif the channel of the current base site is not included in allowed site channels
-
Constructor Details
-
SiteChannelRestrictionAspect
public SiteChannelRestrictionAspect(BaseSiteService baseSiteService, ConfigurationService configurationService)
-
-
Method Details
-
validateSiteChannel
public Object validateSiteChannel(org.aspectj.lang.ProceedingJoinPoint proceedingJoinPoint) throws Throwable Logic of the pointcut for restricting an OCC endpoint annotated withSiteChannelRestrictionbased on site channel, throwsAccessDeniedExceptionif the channel of the current base site is not included in allowed site channels- Parameters:
proceedingJoinPoint- is the join point which matches the defined pointcut- Returns:
- target method invocation of
- Throws:
Throwable
-
getMethod
Returns the intercepted method annotated withSiteChannelRestriction- Parameters:
proceedingJoinPoint- is the intercepted joint point based onSiteChannelRestrictionannotation- Returns:
- method annotated with
SiteChannelRestriction
-
isBaseSiteAllowed
Checks if the site channel of a base site is an allowed site channel- Parameters:
baseSite- is the given base site- Returns:
- true if the given base site's channel is in allowed site channels, false otherwise
-
isSiteChannelAllowed
Checks if the given site channel is an allowed site channel- Parameters:
siteChannel- is the given site channelmethod- is the executed method- Returns:
- true if the given site channel is in allowed site channels, false otherwise
-
getMethodAllowedSiteChannelsProperty
Gets method allowed site channels value based onSiteChannelRestrictionannotation. Allowed site channels are read from properties files (project.properties, local.properties).If there is no annotation
SiteChannelRestrictiondefined for the method, all site channels are returnedIf there is no
allowedSiteChannelsPropertyor no value for property with given name, an empty array will be returned -
getBaseSiteService
-
getConfigurationService
-