Class AccessControlHelper

java.lang.Object
com.skava.helper.AccessControlHelper

public final class AccessControlHelper extends Object
This class hold the set of methods for access control using the authorization component of skava framework.
Author:
Infosys Equinox
  • Field Details

  • Method Details

    • hasSelfAccess

      public static boolean hasSelfAccess(Long userIdFromToken, Long userId)
      This method return the accessibility result of self access. It checks whether the token userid and userid from request remains same.
      Parameters:
      userIdFromToken - a Long object. Indicates the token user id.
      userId - a Long object. Indicates the requested user id.
      Returns:
      A Boolean object. Hold the result of access validation.
    • preAuthorize

      public static void preAuthorize(com.skava.core.auth.AuthTokenHandler authTokenHandler, UserCommonServices userCommonServices, String privilege, List<Long> userIds, long collectionId, long businessId, String locale)
      This method is used to check pre authorize by checking user id and privileges for business id.
      Parameters:
      authTokenHandler - Holds AuthTokenHandler object for getting userid from token and check privileges for business id
      userCommonServices - a UserCommonServices object for loading message source.
      privilege - a String object. Indicates the privilege of the user.
      userIds - a List of Long objects. Indicates the user ids.
      collectionId - a Long object. Indicates the collection id.
      businessId - a Long object. Indicates the business id.
      locale - a String object. Indicates the locale object.
    • preAuthorize

      public static void preAuthorize(com.skava.core.auth.AuthTokenHandler authTokenHandler, UserCommonServices userCommonServices, String privilege, long userId, long collectionId, long businessId, String locale)
      This method is used to check pre authorize by checking user id and privileges for business id.
      Parameters:
      authTokenHandler - Holds AuthTokenHandler object for getting userid from token and check privileges for business id
      userCommonServices - a UserCommonServices object for loading message source.
      privilege - a String object. Indicates the privilege of the user.
      userId - a List of Long objects. Indicates the user id.
      collectionId - a Long object. Indicates the collection id.
      businessId - a Long object. Indicates the business id.
      locale - a String object. Indicates the locale object.
    • checkingRoles

      public static void checkingRoles(com.skava.core.auth.AuthTokenHandler authTokenHandler, UserCommonServices userCommonServices, long userId, long collectionId, String locale)
    • preAuthorize

      public static void preAuthorize(com.skava.core.auth.AuthTokenHandler authTokenHandler, UserCommonServices userCommonServices, String privilege, long userId, long collectionId, String locale)
      This method is used to check pre authorize by checking user id and privileges for business id.
      Parameters:
      authTokenHandler - Holds AuthTokenHandler object for getting userid from token and check privileges for business id
      userCommonServices - a UserCommonServices object for loading message source.
      privilege - a String object. Indicates the privilege of the user.
      userId - a List of Long objects. Indicates the user id.
      collectionId - a Long object. Indicates the collection id.
      locale - a String object. Indicates the locale object.
    • preAuthorize

      public static void preAuthorize(com.skava.core.auth.AuthTokenHandler authTokenHandler, UserCommonServices userCommonServices, String privilege, String locale, long collectionId, long businessId)
      This method is used to check pre authorize by checking user id and privileges for business id.
      Parameters:
      authTokenHandler - Holds AuthTokenHandler object for getting userid from token and check privileges for business id
      userCommonServices - a UserCommonServices object for loading message source.
      privilege - a String object. Indicates the privilege of the user.
      locale - a String object. Indicates the locale object.
      collectionId - a Long object. Indicates the collection id.
      businessId - a Long object. Indicates the business id.
    • getAdminOrUserId

      public static Long getAdminOrUserId(com.skava.core.auth.AuthTokenHandler authTokenHandler)
      This method will return admin userid if it is 0 then return userid
      Parameters:
      authTokenHandler - authTokenHandler
      Returns:
      long adminid or userid