Interface IAuthorizationAction


public interface IAuthorizationAction
The IAuthorizationAction interface defines the contract for actions that can be authorized via the authorization system.

An action is identified by its name, which is a unique string that represents the action within the system. It is recommended that the action name uses a reverse domain name notation (e.g., "com.example.action").

Accordingly, equality is based on the action name. The implementations of the Object.equals(Object) and Object.hashCode() methods must ensure this behavior.

The string representation of this action, as returned by Object.toString(), should be appropriate for logging and debugging purposes.

  • Method Details

    • getName

      @NonNull String getName()
      Gets the name of the action.
      Returns:
      The action name, never null or empty.
    • getLocalizedDisplayName

      @NonNull default String getLocalizedDisplayName()
      Gets the localized display name of the action for the default locale.

      This method is syntactic sugar for getLocalizedDisplayName(null).

      Returns:
      The localized name, never null or empty.
    • getLocalizedDisplayName

      @NonNull default String getLocalizedDisplayName(@Nullable String locale)
      Gets the localized display name of the action for a specific locale.

      If there is no localization available whatsoever, the action name should be returned. This is ensured by the default implementation of this method.

      Parameters:
      locale - The locale to use for localization. The default locale is used if the string is null or empty.
      Returns:
      The localized name, never null or empty.
    • getLocalizedDescription

      @Nullable default String getLocalizedDescription()
      Gets the localized description of the action for the default locale.

      This method is syntactic sugar for getLocalizedDescription(null).

      Returns:
      The localized description.
    • getLocalizedDescription

      @Nullable default String getLocalizedDescription(@Nullable String locale)
      Gets the localized description of the action for a specific locale.

      The default implementation returns an empty string.

      Parameters:
      locale - The locale to use for localization. The default locale is used if the string is null or empty.
      Returns:
      The localized description.
    • getResourceTypes

      @NonNull default Set<String> getResourceTypes()
      Get the set of resource types that this action can be performed on / applied to.

      Self Actions

      An action may be intransitive, meaning it does not require a resource to be performed on. In this case, the action is referred to as a self action.

      Other terms commonly used to describe this type of action include complete, self-contained and self-performing.

      Examples are "login", "logout", etc.

      A self action has an empty set of resource types.

      Resource Actions

      An action may also be transitive, meaning it requires a resource to be performed on. In this case, the action is referred to as a resource action.

      Examples are "read a file", "write to a folder", "delete a model", etc.

      A resource action has a non-empty set of resource types, defining the types of resources it can be performed on.

      Resource Types

      Resource types are identified by a string and are not limited by the platform. Actions can reference arbitrary resource types, whether these actions are registered by the platform or by plugins.

      Returns:
      A set of resource type names; never null.
    • isSelfAction

      default boolean isSelfAction()
      Indicates if this action is a self action.

      This method is syntactic sugar for checking if the action has any resource types defined.

      For information on the concept of self action, see getResourceTypes().

      Returns:
      true if the action is a self action; false otherwise.
    • isResourceAction

      default boolean isResourceAction()
      Indicates if this action is a resource action.

      This method is syntactic sugar for checking if the action has any associated resource types.

      For information on the concept of resource action, see getResourceTypes().

      Returns:
      true if the action is a resource action; false otherwise.
    • performsOnResourceType

      default boolean performsOnResourceType(@NonNull String resourceType)
      Indicates if this action can be performed on / applies to a resource of the specified type.

      This method is syntactic sugar for checking if a given resource type is part of the action's supported resource types.

      Parameters:
      resourceType - The resource type.
      Returns:
      true if the action can be performed on the specified resource type; false otherwise.
      Throws:
      IllegalArgumentException - if the resource type is null or empty.
      See Also: