Interface IAuthorizationAction
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 Summary
Modifier and TypeMethodDescriptiondefault StringGets the localized description of the action for the default locale.default StringgetLocalizedDescription(String locale) Gets the localized description of the action for a specific locale.default StringGets the localized display name of the action for the default locale.default StringgetLocalizedDisplayName(String locale) Gets the localized display name of the action for a specific locale.getName()Gets the name of the action.Get the set of resource types that this action can be performed on / applied to.default booleanIndicates if this action is a resource action.default booleanIndicates if this action is a self action.default booleanperformsOnResourceType(String resourceType) Indicates if this action can be performed on / applies to a resource of the specified type.
-
Method Details
-
getName
Gets the name of the action.- Returns:
- The action name, never
nullor empty.
-
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
nullor empty.
-
getLocalizedDisplayName
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 isnullor empty.- Returns:
- The localized name, never
nullor empty.
-
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
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 isnullor empty.- Returns:
- The localized description.
-
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:
trueif the action is a self action;falseotherwise.
-
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:
trueif the action is a resource action;falseotherwise.
-
performsOnResourceType
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:
trueif the action can be performed on the specified resource type;falseotherwise.- Throws:
IllegalArgumentException- if the resource type isnullor empty.- See Also:
-