Class ScriptedGrantHooks


  • public class ScriptedGrantHooks
    extends GrantHooksInterface
    Scripted grant hooks
    Execute the grant hooks' common server script or dynamic Java class
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean changeScope​(Grant g, View home)
      This method is called when the user has changed its application scope
      static void clear()  
      static java.lang.String customAuth​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      This method is called before any standard authentication mechanism
      It can be used to return a custom authentication string from the incoming request
      static void downloadDocument​(Grant g, DocumentDB doc)
      Hook called after allowing document for download
      static java.lang.String event​(Grant g, java.lang.String origin, java.lang.Object data)
      Hook called when receiving asynchronous event
      static java.lang.String generatePassword​(Grant g)
      This method is called to generate a new password
      The default implementation generates a random password
      static void init​(Grant g, Parameters params)
      This method is dedicated to be called when initializing presentation layers (in particular it is called by generic web UI main page display)
      static boolean isMenuEnable​(Grant g, java.lang.String domain, java.lang.String item)
      Hook to limit access to menu
      static void logout​(Grant g)
      This method is called before the logout
      static java.lang.String parseAuth​(Grant sys, SessionInfo info)
      This method is called for session info to extract user login from
      static void postAuth​(Grant sys, java.lang.String login, boolean success)
      This method is called after processing the internal authentication
      static void postLoadGrant​(Grant g)
      This method is called after loading grant
      static java.lang.String postLoadHome​(Grant g, java.lang.String h)
      This method is called after loading home page (and before assigning it)
      static void postLoadLogEvents​(Grant g)
      This method is called after loading log events
      static void postLoadMenu​(Grant g)
      This method is called after loading user's menu
      static void postLoadProfile​(Grant g)
      This method is called after loading user profile data
      static void postLoadResponsibilities​(Grant g)
      This method is called after loading user's menu
      static java.util.List<java.lang.String> postLoadScope​(Grant g, java.util.List<java.lang.String> views)
      Hook to customize the available scopes
      static void postLoadSystemParams​(Grant g)
      This method is called after loading of system parameters
      static java.lang.String postPlatformInit​(Grant sys)
      This method is called after platform initialization
      static java.util.List<SearchItem> postSearchIndex​(Grant g, java.util.List<SearchItem> rows)
      Hook to change the result after the search in index
      static void preAuth​(Grant sys, java.lang.String login, java.lang.String password)
      This method is called before processing the internal authentication
      static void preLoadGrant​(Grant g)
      This method is called before loading grant
      static void preLoadHome​(Grant g)
      This method is called before loading home page
      static void preLoadLogEvents​(Grant g)
      This method is called before loading log events
      static void preLoadMenu​(Grant g)
      This method is called before loading loading user's menu
      static void preLoadProfile​(Grant g)
      This method is called before loading user profile data
      static void preLoadResponsibilities​(Grant g)
      This method is called before loading loading user's responsibilities
      static void preLoadSystemParams​(Grant g)
      This method is called before loading of system parameters
      static java.lang.String preSearchIndex​(Grant g, java.lang.String search)
      Hook to change the query before the search in index
      static void socialPost​(Grant g, java.lang.String postId, java.lang.String userId, java.lang.String message, boolean pub, java.lang.String target, java.lang.String rowId, java.lang.String level, java.lang.String status)
      Hook called on social post
      static java.lang.String unitTests​(Grant g)
      Unit tests
      static java.util.List<java.lang.String> validatePassword​(Grant g, java.lang.String password)
      This method is called before updating the password
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ScriptedGrantHooks

        public ScriptedGrantHooks()
    • Method Detail

      • clear

        public static void clear()
      • customAuth

        public static java.lang.String customAuth​(javax.servlet.http.HttpServletRequest request,
                                                  javax.servlet.http.HttpServletResponse response)
                                           throws java.lang.Exception
        This method is called before any standard authentication mechanism
        It can be used to return a custom authentication string from the incoming request
        Parameters:
        request - HTTP request
        response - HTTP response
        Throws:
        java.lang.Exception
      • postPlatformInit

        public static java.lang.String postPlatformInit​(Grant sys)
        This method is called after platform initialization
        Parameters:
        sys - System admin grant
      • parseAuth

        public static java.lang.String parseAuth​(Grant sys,
                                                 SessionInfo info)
        This method is called for session info to extract user login from
        Parameters:
        sys - System admin grant
        info - Session info
        Returns:
        Login
      • preAuth

        public static void preAuth​(Grant sys,
                                   java.lang.String login,
                                   java.lang.String password)
                            throws GrantException
        This method is called before processing the internal authentication
        Parameters:
        sys - System admin grant
        login - Authentication string
        password - Authentication password
        Throws:
        GrantException - to cancel the authentication process
      • postAuth

        public static void postAuth​(Grant sys,
                                    java.lang.String login,
                                    boolean success)
                             throws GrantException
        This method is called after processing the internal authentication
        Parameters:
        sys - System admin grant
        login - Authentication string
        success - Authentication success?
        Throws:
        GrantException - to cancel the authentication success
      • preLoadGrant

        public static void preLoadGrant​(Grant g)
        This method is called before loading grant
        Parameters:
        g - Grant
      • postLoadGrant

        public static void postLoadGrant​(Grant g)
        This method is called after loading grant
        Parameters:
        g - Grant
      • preLoadSystemParams

        public static void preLoadSystemParams​(Grant g)
        This method is called before loading of system parameters
        Parameters:
        g - Grant
      • postLoadSystemParams

        public static void postLoadSystemParams​(Grant g)

        This method is called after loading of system parameters

        Parameters:
        g - Grant
      • preLoadProfile

        public static void preLoadProfile​(Grant g)
        This method is called before loading user profile data
        Parameters:
        g - Grant
      • postLoadProfile

        public static void postLoadProfile​(Grant g)
        This method is called after loading user profile data
        Parameters:
        g - Grant
      • preLoadResponsibilities

        public static void preLoadResponsibilities​(Grant g)
        This method is called before loading loading user's responsibilities
        Parameters:
        g - Grant
      • postLoadResponsibilities

        public static void postLoadResponsibilities​(Grant g)
        This method is called after loading user's menu
        Parameters:
        g - Grant
      • preLoadMenu

        public static void preLoadMenu​(Grant g)
        This method is called before loading loading user's menu
        Parameters:
        g - Grant
      • postLoadMenu

        public static void postLoadMenu​(Grant g)
        This method is called after loading user's menu
        Parameters:
        g - Grant
      • preLoadHome

        public static void preLoadHome​(Grant g)
        This method is called before loading home page
        Parameters:
        g - Grant
      • postLoadHome

        public static java.lang.String postLoadHome​(Grant g,
                                                    java.lang.String h)
        This method is called after loading home page (and before assigning it)
        Parameters:
        g - Grant
        h - Home page name
        Returns:
        New home page name or null if no home page
      • preLoadLogEvents

        public static void preLoadLogEvents​(Grant g)
        This method is called before loading log events
        Parameters:
        g - Grant
      • postLoadLogEvents

        public static void postLoadLogEvents​(Grant g)
        This method is called after loading log events
        Parameters:
        g - Grant
      • generatePassword

        public static java.lang.String generatePassword​(Grant g)
        This method is called to generate a new password
        The default implementation generates a random password
        Parameters:
        g - Grant
      • validatePassword

        public static java.util.List<java.lang.String> validatePassword​(Grant g,
                                                                        java.lang.String password)
        This method is called before updating the password
        Parameters:
        g - Grant
        password - Password
      • init

        public static void init​(Grant g,
                                Parameters params)
        This method is dedicated to be called when initializing presentation layers (in particular it is called by generic web UI main page display)
        Parameters:
        g - Grant
        params - Parameters
      • changeScope

        public static boolean changeScope​(Grant g,
                                          View home)
        This method is called when the user has changed its application scope
        Parameters:
        g - Grant
        home - new home page
        Returns:
        true on success
      • postLoadScope

        public static java.util.List<java.lang.String> postLoadScope​(Grant g,
                                                                     java.util.List<java.lang.String> views)
        Hook to customize the available scopes
        Parameters:
        g - User rights
        views - List of home pages based on user rights
        Returns:
        Available views
      • isMenuEnable

        public static boolean isMenuEnable​(Grant g,
                                           java.lang.String domain,
                                           java.lang.String item)
        Hook to limit access to menu
        Parameters:
        g - User rights
        domain - Domain name
        item - Optional Object or Process name
        Returns:
        true when menu item can be displayed
      • preSearchIndex

        public static java.lang.String preSearchIndex​(Grant g,
                                                      java.lang.String search)
        Hook to change the query before the search in index
        Parameters:
        g - User rights
        search - User query
        Returns:
        Overridden query
      • postSearchIndex

        public static java.util.List<SearchItem> postSearchIndex​(Grant g,
                                                                 java.util.List<SearchItem> rows)
        Hook to change the result after the search in index
        Parameters:
        g - User rights
        rows - search result
        Returns:
        Overridden result
      • downloadDocument

        public static void downloadDocument​(Grant g,
                                            DocumentDB doc)
        Hook called after allowing document for download
        Parameters:
        g - User rights
        doc - Document
      • event

        public static java.lang.String event​(Grant g,
                                             java.lang.String origin,
                                             java.lang.Object data)
                                      throws java.lang.Exception
        Hook called when receiving asynchronous event
        Parameters:
        g - User rights
        origin - Event origin
        Returns:
        data Event data
        Throws:
        java.lang.Exception
      • socialPost

        public static void socialPost​(Grant g,
                                      java.lang.String postId,
                                      java.lang.String userId,
                                      java.lang.String message,
                                      boolean pub,
                                      java.lang.String target,
                                      java.lang.String rowId,
                                      java.lang.String level,
                                      java.lang.String status)
        Hook called on social post
        Parameters:
        g - Grant
        postId - Social post row ID
        userId - Author row ID
        message - Posted message
        pub - Public or private?
        target - Optional object name
        rowId - Optional object row ID
        level - Optional level of audit post
        status - Optional status of audit post
      • logout

        public static void logout​(Grant g)
        This method is called before the logout
        Parameters:
        g - Grant
      • unitTests

        public static java.lang.String unitTests​(Grant g)
        Unit tests
        Returns:
        Unit tests results