Class SiteChannelRestrictionAspect
- java.lang.Object
-
- de.hybris.platform.commercewebservicescommons.annotation.SiteChannelRestrictionAspect
-
public class SiteChannelRestrictionAspect extends java.lang.ObjectAspect implementation for restricting an annotated OCC endpoint based on site channel
-
-
Constructor Summary
Constructors Constructor Description SiteChannelRestrictionAspect(BaseSiteService baseSiteService, ConfigurationService configurationService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected BaseSiteServicegetBaseSiteService()protected ConfigurationServicegetConfigurationService()protected java.lang.reflect.MethodgetMethod(org.aspectj.lang.ProceedingJoinPoint proceedingJoinPoint)Returns the intercepted method annotated withSiteChannelRestrictionprotected java.lang.String[]getMethodAllowedSiteChannelsProperty(java.lang.reflect.Method method)Gets method allowed site channels value based onSiteChannelRestrictionannotation.protected booleanisBaseSiteAllowed(BaseSiteModel baseSite, java.lang.reflect.Method method)Checks if the site channel of a base site is an allowed site channelprotected booleanisSiteChannelAllowed(SiteChannel siteChannel, java.lang.reflect.Method method)Checks if the given site channel is an allowed site channeljava.lang.ObjectvalidateSiteChannel(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 Detail
-
SiteChannelRestrictionAspect
public SiteChannelRestrictionAspect(BaseSiteService baseSiteService, ConfigurationService configurationService)
-
-
Method Detail
-
validateSiteChannel
public java.lang.Object validateSiteChannel(org.aspectj.lang.ProceedingJoinPoint proceedingJoinPoint) throws java.lang.ThrowableLogic 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 {@param proceedingJoinPoint}
- Throws:
java.lang.Throwable
-
getMethod
protected java.lang.reflect.Method getMethod(org.aspectj.lang.ProceedingJoinPoint proceedingJoinPoint)
Returns the intercepted method annotated withSiteChannelRestriction- Parameters:
proceedingJoinPoint- is the intercepted joint point based onSiteChannelRestrictionannotation- Returns:
- method annotated with
SiteChannelRestriction
-
isBaseSiteAllowed
protected boolean isBaseSiteAllowed(BaseSiteModel baseSite, java.lang.reflect.Method method)
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
protected boolean isSiteChannelAllowed(SiteChannel siteChannel, java.lang.reflect.Method method)
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
protected java.lang.String[] getMethodAllowedSiteChannelsProperty(java.lang.reflect.Method method)
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
protected BaseSiteService getBaseSiteService()
-
getConfigurationService
protected ConfigurationService getConfigurationService()
-
-