Interface Permission
-
- All Known Implementing Classes:
BatchPermissions,HistoricProcessInstancePermissions,HistoricTaskPermissions,OptimizePermissions,Permissions,ProcessDefinitionPermissions,ProcessInstancePermissions,TaskPermissions,UserOperationLogCategoryPermissions
public interface PermissionA permission represents an authorization to interact with a given resource in a specific way. See
Permissionsfor a set of built-in permissions andAuthorizationfor general overview on authorizations.In Camunda Platform, multiple permissions are grouped into an
Authorization. For efficient storage and checking of authorizations, the permissons that make up an authorization are coded into a single integer. The implication of this design is that a permission must have a unique integer value and it must be a power of two, ie 2^0, 2^1, 2^2, 2^3, 2^4 ... The permission can then be added to an authorization using bitwise OR:Auth: 0000001001001 Perm to add: 0000000010000 bit OR (|) : 0000001011001and removed using bitwise AND of the inverted value:Auth: 0000001001001 Perm to rem: 0000000001000 invert (~) : 1111111110111 bit AND (&): 0000001000001Defining a custom Permission
The XxxPermissions classes contains the values of the built-in permissions (i.e.Permissions,ProcessDefinitionPermissions,ProcessInstancePermissions,TaskPermissions, all can be found inauthorizationpackage). In order to define a custom permission, you must provide an implementation of this interface such that thegetValue()method returns an integer which is a power of two and not yet used by any of the built-in Permissions. Keep the Permission's names unique as well. You must implement alsogetTypes()and make sure that the permission values are not already reserved for the desiredResource.- Since:
- 7.0
- Author:
- Daniel Meyer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.StringgetName()returns the name of the permission, ie.Resource[]getTypes()returns the resource types which are allowed for this permissionintgetValue()returns the unique numeric value of the permission.
-
-
-
Method Detail
-
getName
java.lang.String getName()
returns the name of the permission, ie. 'UPDATE'
-
getValue
int getValue()
returns the unique numeric value of the permission. Must be a power of 2. ie 2^0, 2^1, 2^2, 2^3, 2^4 ...
-
getTypes
Resource[] getTypes()
returns the resource types which are allowed for this permission
-
-