Class Permission
Each permission is represented by a specific instance of Permission.
- Author:
- Kohsuke Kawaguchi
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PermissionGeneric configuration access.static final PermissionGeneric create access.static final PermissionGeneric delete access.final org.jvnet.localizer.LocalizableHuman-readable description of this permission.booleanWhether this permission is available for use.static final PermissionDeprecated.since 2009-01-23.final PermissionGroupstatic final PermissionGroupstatic final PermissionDeprecated.since 2009-01-23.static final PermissionGroupDeprecated.since 2009-01-23.static final Comparator<Permission> Comparator that ordersPermissionobjects based on their ID.final PermissionBundledPermissionthat also implies this permission.final StringHuman readable ID of the permission.final Classstatic final PermissionGeneric read access.static final PermissionGeneric update access.static final PermissionGeneric write access. -
Constructor Summary
ConstructorsConstructorDescriptionPermission(PermissionGroup group, String name, Permission impliedBy) Deprecated.since 1.257.Permission(PermissionGroup group, String name, org.jvnet.localizer.Localizable description, Permission impliedBy) Deprecated.Permission(PermissionGroup group, String name, org.jvnet.localizer.Localizable description, Permission impliedBy, boolean enable) Deprecated.Permission(PermissionGroup group, String name, org.jvnet.localizer.Localizable description, Permission impliedBy, boolean enable, PermissionScope[] scopes) Defines a new permission.Permission(PermissionGroup group, String name, org.jvnet.localizer.Localizable description, Permission impliedBy, PermissionScope scope) -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic PermissionConvert the ID representation intoPermissionobject.static List<Permission> getAll()Returns all thePermissions available in the system.booleangetId()Returns the string representation of thisPermission, which can be converted back toPermissionvia thefromId(String)method.inthashCode()booleanChecks if this permission is contained in the specified scope, (either directly or indirectly.)voidsetEnabled(boolean enable) toString()
-
Field Details
-
ID_COMPARATOR
Comparator that ordersPermissionobjects based on their ID. -
owner
-
group
-
name
Human readable ID of the permission.This name should uniquely determine a permission among its owner class. The name must be a valid Java identifier.
The expected naming convention is something like "BrowseWorkspace".
-
description
@CheckForNull public final org.jvnet.localizer.Localizable descriptionHuman-readable description of this permission. Used as a tooltip to explain this permission, so this message should be a couple of sentences long.If null, there will be no description text.
-
impliedBy
BundledPermissionthat also implies this permission.This allows us to organize permissions in a hierarchy, so that for example we can say "view workspace" permission is implied by the (broader) "read" permission.
The idea here is that for most people, access control based on such broad permission bundle is good enough, and those few that need finer control can do so.
-
enabled
public boolean enabledWhether this permission is available for use.This allows us to dynamically enable or disable the visibility of permissions, so administrators can control the complexity of their permission matrix.
- Since:
- 1.325
-
HUDSON_PERMISSIONS
Deprecated.since 2009-01-23. AccessJenkins.PERMISSIONSinstead.PermissionGroupforJenkins. -
HUDSON_ADMINISTER
Deprecated.since 2009-01-23. AccessJenkins.ADMINISTERinstead.Permissionthat represents the God-like access. Equivalent of Unix root.All permissions are eventually implied by this permission.
-
GROUP
-
FULL_CONTROL
Deprecated.since 2009-01-23. UseJenkins.ADMINISTER.Historically this was separate fromHUDSON_ADMINISTERbut such a distinction doesn't make sense any more, so deprecated. -
READ
Generic read access. -
WRITE
Generic write access. -
CREATE
Generic create access. -
UPDATE
Generic update access. -
DELETE
Generic delete access. -
CONFIGURE
Generic configuration access.
-
-
Constructor Details
-
Permission
public Permission(@NonNull PermissionGroup group, @NonNull String name, @CheckForNull org.jvnet.localizer.Localizable description, @CheckForNull Permission impliedBy, boolean enable, @NonNull PermissionScope[] scopes) throws IllegalStateException Defines a new permission.- Parameters:
group- Permissions are grouped per classes that own them. Specify the permission group created for that class. The idiom is:class Foo { private static final PermissionGroup PERMISSIONS = new PermissionGroup(Foo.class,...); public static final Permission ABC = new Permission(PERMISSION,...) ; }Because of the classloading problems and the difficulty for Hudson to enumerate them, the permission constants really need to be static field of the owner class.name- Seename.description- Seedescription.impliedBy- SeeimpliedBy.- Throws:
IllegalStateException- if this permission was already defined
-
Permission
public Permission(@NonNull PermissionGroup group, @NonNull String name, @CheckForNull org.jvnet.localizer.Localizable description, @CheckForNull Permission impliedBy, @NonNull PermissionScope scope) -
Permission
@Deprecated public Permission(@NonNull PermissionGroup group, @NonNull String name, @CheckForNull org.jvnet.localizer.Localizable description, @CheckForNull Permission impliedBy, boolean enable) Deprecated. -
Permission
@Deprecated public Permission(@NonNull PermissionGroup group, @NonNull String name, @CheckForNull org.jvnet.localizer.Localizable description, @CheckForNull Permission impliedBy) Deprecated. -
Permission
@Deprecated public Permission(@NonNull PermissionGroup group, @NonNull String name, @CheckForNull Permission impliedBy) Deprecated.since 1.257. UsePermission(PermissionGroup, String, Localizable, Permission)
-
-
Method Details
-
isContainedBy
Checks if this permission is contained in the specified scope, (either directly or indirectly.) -
getId
Returns the string representation of thisPermission, which can be converted back toPermissionvia thefromId(String)method.This string representation is suitable for persistence.
- Returns:
- ID with the following format: permissionClass.permissionName
- See Also:
-
equals
-
hashCode
public int hashCode() -
fromId
Convert the ID representation intoPermissionobject.- Returns:
- null if the conversion failed.
- See Also:
-
toString
-
setEnabled
public void setEnabled(boolean enable) -
getEnabled
public boolean getEnabled() -
getAll
Returns all thePermissions available in the system.- Returns:
- always non-null. Read-only.
-