Class SiteChannelRestrictionAspect


  • public class SiteChannelRestrictionAspect
    extends java.lang.Object
    Aspect implementation for restricting an annotated OCC endpoint based on site channel
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected BaseSiteService getBaseSiteService()  
      protected ConfigurationService getConfigurationService()  
      protected java.lang.reflect.Method getMethod​(org.aspectj.lang.ProceedingJoinPoint proceedingJoinPoint)
      Returns the intercepted method annotated with SiteChannelRestriction
      protected java.lang.String[] getMethodAllowedSiteChannelsProperty​(java.lang.reflect.Method method)
      Gets method allowed site channels value based on SiteChannelRestriction annotation.
      protected boolean isBaseSiteAllowed​(BaseSiteModel baseSite, java.lang.reflect.Method method)
      Checks if the site channel of a base site is an allowed site channel
      protected boolean isSiteChannelAllowed​(SiteChannel siteChannel, java.lang.reflect.Method method)
      Checks if the given site channel is an allowed site channel
      java.lang.Object validateSiteChannel​(org.aspectj.lang.ProceedingJoinPoint proceedingJoinPoint)
      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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • validateSiteChannel

        public java.lang.Object validateSiteChannel​(org.aspectj.lang.ProceedingJoinPoint proceedingJoinPoint)
                                             throws java.lang.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 {@param proceedingJoinPoint}
        Throws:
        java.lang.Throwable
      • getMethod

        protected java.lang.reflect.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,
                                            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 channel
        method - 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 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