Class SiteChannelRestrictionAspect

java.lang.Object
de.hybris.platform.commercewebservicescommons.annotation.SiteChannelRestrictionAspect

public class SiteChannelRestrictionAspect extends Object
Aspect implementation for restricting an annotated OCC endpoint based on site channel
  • Constructor Details

  • Method Details

    • validateSiteChannel

      public Object validateSiteChannel(org.aspectj.lang.ProceedingJoinPoint proceedingJoinPoint) throws Throwable
      Logic of the pointcut for restricting an OCC endpoint annotated with SiteChannelRestriction based on site channel, throws AccessDeniedException if 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

      protected Method getMethod(org.aspectj.lang.ProceedingJoinPoint proceedingJoinPoint)
      Returns the intercepted method annotated with SiteChannelRestriction
      Parameters:
      proceedingJoinPoint - is the intercepted joint point based on SiteChannelRestriction annotation
      Returns:
      method annotated with SiteChannelRestriction
    • isBaseSiteAllowed

      protected boolean isBaseSiteAllowed(BaseSiteModel baseSite, 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, Method method)
      Checks if the given site channel is an allowed site channel
      Parameters:
      siteChannel - is the given site channel
      method - is the executed method
      Returns:
      true if the given site channel is in allowed site channels, false otherwise
    • getMethodAllowedSiteChannelsProperty

      protected String[] getMethodAllowedSiteChannelsProperty(Method method)
      Gets method allowed site channels value based on SiteChannelRestriction annotation. Allowed site channels are read from properties files (project.properties, local.properties).

      If there is no annotation SiteChannelRestriction defined for the method, all site channels are returned

      If there is no allowedSiteChannelsProperty or no value for property with given name, an empty array will be returned

    • getBaseSiteService

      protected BaseSiteService getBaseSiteService()
    • getConfigurationService

      protected ConfigurationService getConfigurationService()