public enum PermissionLevel extends Enum<PermissionLevel>
This enumeration lists possible values for the access levels. Each user is assigned one of the following levels, based on the permission rules set up for the structure.
The permissions are linear - next permission level includes everything that was allowed in the previous permission level, and a serial number defined for each level can be used in comparing levels.
Usually, when a permission level is passed as a parameter, it's supposed to be @Nullable. A
null
value is treated as NONE
.
PermissionRule
,
Structure Permissions (Structure Documentation)Enum Constant and Description |
---|
ADMIN
The user is allowed to view and edit the structure, create and edit generators and effectors, and also change its properties and permissions and delete it.
|
AUTOMATE
The user is allowed to view and edit the structure, create and edit generators and effectors in it.
|
EDIT
The user is allowed to view and edit the structure.
|
EDIT_GENERATORS
Deprecated.
Use
AUTOMATE instead. |
NONE
No permissions - the user is not allowed to view this structure or know that it exists.
|
VIEW
View permission - the user is allowed to view the structure, but they cannot change it.
|
Modifier and Type | Method and Description |
---|---|
static PermissionLevel |
fromSerial(int serial)
Used to look up permission level by serial number.
|
int |
getSerial() |
boolean |
includes(PermissionLevel requiredPermission)
Used to check whether effective permission is enough to do something:
if (permission.includes(PermissionLevel.EDIT)) |
static PermissionLevel |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static PermissionLevel[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final PermissionLevel NONE
public static final PermissionLevel VIEW
public static final PermissionLevel EDIT
@Deprecated public static final PermissionLevel EDIT_GENERATORS
AUTOMATE
instead.public static final PermissionLevel AUTOMATE
public static final PermissionLevel ADMIN
public static PermissionLevel[] values()
for (PermissionLevel c : PermissionLevel.values()) System.out.println(c);
public static PermissionLevel valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic int getSerial()
public boolean includes(@Nullable PermissionLevel requiredPermission)
Used to check whether effective permission is enough to do something:
if (permission.includes(PermissionLevel.EDIT))
Any permission includes NONE
level, and null
permission level is treated as NONE
.
requiredPermission
- required permission levelStructureManager.isAccessible(java.lang.Long, com.almworks.jira.structure.api.permissions.PermissionLevel)
@NotNull public static PermissionLevel fromSerial(int serial)
Used to look up permission level by serial number. This is used in serialization or transferring permissions.
If serial number does not match one of the levels, the highest level with the serial number less than specified will be used.
serial
- serial numberCopyright © 2024 Tempo Software. All Rights Reserved.