Class PermissionHelper
java.lang.Object
org.jenkinsci.plugins.rolestrategy.permissions.PermissionHelper
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
public class PermissionHelper
extends Object
Helper methods for dangerous permission handling.
- Author:
- Oleg Nenashev
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Set<Permission>
List of the dangerous permissions, which need to be suppressed by the plugin. -
Method Summary
Modifier and TypeMethodDescriptionstatic Permission
findPermission
(String id) Attempt to match a given permission to what is defined in the UI.static String
Attempt to match a given permission to what is defined in the UI.static Set<Permission>
fromStrings
(Collection<String> permissionStrings, boolean allowPermissionId) Convert a set of string to a collection of permissions.static boolean
Check if the permissions is dangerous.static Permission
Attempt to match a given permission to what is defined in the UI or from the ID representation used in the config.xml
-
Field Details
-
DANGEROUS_PERMISSIONS
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static final Set<Permission> DANGEROUS_PERMISSIONSList of the dangerous permissions, which need to be suppressed by the plugin.
-
-
Method Details
-
fromStrings
@NonNull public static Set<Permission> fromStrings(@CheckForNull Collection<String> permissionStrings, boolean allowPermissionId) Convert a set of string to a collection of permissions. Dangerous and non-solvable permissions are ignored- Parameters:
permissionStrings
- A list of Permission IDs or UI names.allowPermissionId
- Allow to resolve the permission from the ID.- Returns:
- Created set of permissions
-
isDangerous
Check if the permissions is dangerous.- Parameters:
p
- Permission- Returns:
true
if the permission is considered as dangerous.
-
findPermission
Attempt to match a given permission to what is defined in the UI.- Parameters:
id
- String of the form "Title/Permission" (Look in the UI) for a particular permission- Returns:
- a matched permission
-
findPermissionId
Attempt to match a given permission to what is defined in the UI.- Parameters:
id
- String of the form "Title/Permission" (Look in the UI) for a particular permission- Returns:
- a matched permission ID
-
resolvePermissionFromString
Attempt to match a given permission to what is defined in the UI or from the ID representation used in the config.xml- Parameters:
id
- String of the form "Title/Permission" (Look in the UI) for a particular permission or in the form used in the config.xml- Returns:
- a matched permission, null if permission couldn't be resolved or is dangerous
-