Enum AccessRight

  • All Implemented Interfaces:
    Serializable, Comparable<AccessRight>

    public enum AccessRight
    extends Enum<AccessRight>
    Utility class to describe the possible values used in the RAR objects when accessing the Authlete API with an access token. The enum values each represent a specific possible value of the action field of the RAR object. Each AccessRight value in turn is aware of whether the action is specific to a particular service or client, which necessitate the presence of the service and client fields of the RAR object, respectively. Each AccessRight value also knows which other AccessRights it subsumes. For example, the USE_SERVICE value also includes the VIEW_SERVICE and VIEW_CLIENT actions inherently. The AUTHLETE_API_V3 constant is used as the type value for all RAR objects addressing the Authlete API.
    Since:
    3.73
    Author:
    jricher
    • Enum Constant Detail

      • VIEW_CLIENT

        public static final AccessRight VIEW_CLIENT
        can view client details on this service or client
      • MODIFY_CLIENT

        public static final AccessRight MODIFY_CLIENT
        can modify existing clients on this service or client
      • VIEW_SERVICE

        public static final AccessRight VIEW_SERVICE
        can view the details of this service
      • USE_SERVICE

        public static final AccessRight USE_SERVICE
        can use the non-destructive service API calls (auth endpoint, token endpoint, etc.)
      • CREATE_CLIENT

        public static final AccessRight CREATE_CLIENT
        can create new clients on this service
      • MODIFY_SERVICE

        public static final AccessRight MODIFY_SERVICE
        can modify this service
      • VIEW_DEFAULT_SERVICE

        public static final AccessRight VIEW_DEFAULT_SERVICE
        can view default service parameters
      • CREATE_SERVICE

        public static final AccessRight CREATE_SERVICE
        can create additional services
      • DELETE_SERVICE

        public static final AccessRight DELETE_SERVICE
        can delete a specific service
      • ADMIN

        public static final AccessRight ADMIN
        can call administrative functions on the Authlete server
    • Field Detail

      • AUTHLETE_API_V3

        public static final String AUTHLETE_API_V3
        The type value of the RAR object for the authlete API.
        See Also:
        Constant Field Values
    • Method Detail

      • values

        public static AccessRight[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (AccessRight c : AccessRight.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static AccessRight valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • isServiceSpecific

        public boolean isServiceSpecific()
        Return true if this access right requires a specific service to be applied.
      • isClientSpecific

        public boolean isClientSpecific()
        Return true if this access right requires a specific service and client to be applied.
        Returns:
      • canDo

        public boolean canDo​(long clientId,
                             long serviceId,
                             AccessRight compare)
        Return true if this access right has at least the amount of access of the compared access right. This checks whether the clientId and serviceId parameters are present if they are required for the given access right to function.
      • fromJson

        public static AccessRight fromJson​(String key)
        Look up and fetch an access right value based on its (lowercased) name from a JSON object.
      • toJson

        public String toJson()
        Return the name of this access right in lowercase form, appropriate for use in JSON objects (such as RAR object values).