public interface GlobalPermissionManager
The system global permissions are:
GlobalPermissionKey.SYSTEM_ADMIN
GlobalPermissionKey.ADMINISTER
GlobalPermissionKey.USE
GlobalPermissionKey.USER_PICKER
GlobalPermissionKey.CREATE_SHARED_OBJECTS
GlobalPermissionKey.MANAGE_GROUP_FILTER_SUBSCRIPTIONS
GlobalPermissionKey.BULK_CHANGE
getAllGlobalPermissions()
in order to get the collection of all global permissions, which includes
plugin global permissions.
For project specific permissions use PermissionManager
.
Modifier and Type | Method and Description |
---|---|
boolean |
addPermission(GlobalPermissionType globalPermissionType,
String group)
Grants a user group a global permission.
|
boolean |
addPermission(int permissionType,
String group)
Deprecated.
|
void |
clearCache() |
Collection<GlobalPermissionType> |
getAllGlobalPermissions() |
com.atlassian.fugue.Option<GlobalPermissionType> |
getGlobalPermission(GlobalPermissionKey permissionKey)
Returns the global permission details for the given permission key.
|
com.atlassian.fugue.Option<GlobalPermissionType> |
getGlobalPermission(int permissionId)
Deprecated.
use
getGlobalPermission(GlobalPermissionKey)
to get global permission by key. Eventually, we want to stop referring to Global Permission's by ID. |
com.atlassian.fugue.Option<GlobalPermissionType> |
getGlobalPermission(String permissionKey)
Returns a global permission matching the specified key.
|
Collection<String> |
getGroupNames(GlobalPermissionType globalPermissionType)
Deprecated.
Use
getGroupNamesWithPermission(com.atlassian.jira.permission.GlobalPermissionKey) instead. Since v6.2.5. |
Collection<String> |
getGroupNames(int permissionId)
|
Collection<String> |
getGroupNamesWithPermission(GlobalPermissionKey permissionKey)
Retrieve all the group names with this permission.
|
Collection<com.atlassian.crowd.embedded.api.Group> |
getGroupsWithPermission(GlobalPermissionKey permissionKey)
Retrieve all the groups with the given permission.
|
Collection<com.atlassian.crowd.embedded.api.Group> |
getGroupsWithPermission(GlobalPermissionType globalPermissionType)
Deprecated.
Use
getGroupsWithPermission(com.atlassian.jira.permission.GlobalPermissionKey) instead. Since v6.2.5. |
Collection<com.atlassian.crowd.embedded.api.Group> |
getGroupsWithPermission(int permissionId)
|
Collection<GlobalPermissionEntry> |
getPermissions(GlobalPermissionKey globalPermissionKey)
Retrieve a list of user groups which have been granted the specified permission.
|
Collection<GlobalPermissionEntry> |
getPermissions(GlobalPermissionType globalPermissionType)
Deprecated.
Use
getPermissions(com.atlassian.jira.permission.GlobalPermissionKey) instead. Since v6.2.5. |
Collection<JiraPermission> |
getPermissions(int permissionType)
Deprecated.
|
boolean |
hasPermission(GlobalPermissionKey globalPermissionKey,
ApplicationUser user)
Check if the given user has the given Global Permission.
|
boolean |
hasPermission(GlobalPermissionType globalPermissionType)
Deprecated.
Use
hasPermission(com.atlassian.jira.permission.GlobalPermissionKey, com.atlassian.jira.user.ApplicationUser) instead. Since v6.2.5. |
boolean |
hasPermission(GlobalPermissionType globalPermissionType,
ApplicationUser user)
Deprecated.
Use
hasPermission(com.atlassian.jira.permission.GlobalPermissionKey, com.atlassian.jira.user.ApplicationUser) instead. Since v6.2.5. |
boolean |
hasPermission(int permissionType)
|
boolean |
hasPermission(int permissionType,
ApplicationUser user)
|
boolean |
isGlobalPermission(int permissionId)
Deprecated.
Use
GlobalPermissionKey instead of int . Since v6.2.5 |
boolean |
isPermissionManagedByJira(GlobalPermissionKey permissionKey)
Checks if jira should be responsible for managing a permission.
|
boolean |
removePermission(GlobalPermissionType globalPermissionType,
String group)
Revokes a global permission for a user group
|
boolean |
removePermission(int permissionType,
String group)
Deprecated.
|
boolean |
removePermissions(String group)
Revoke all global permissions for a user group.
|
@ExperimentalApi Collection<GlobalPermissionType> getAllGlobalPermissions()
@Internal com.atlassian.fugue.Option<GlobalPermissionType> getGlobalPermission(int permissionId)
getGlobalPermission(GlobalPermissionKey)
to get global permission by key. Eventually, we want to stop referring to Global Permission's by ID.permissionId
- id of the permission.@ExperimentalApi com.atlassian.fugue.Option<GlobalPermissionType> getGlobalPermission(@Nonnull GlobalPermissionKey permissionKey)
permissionKey
- the global permission key@ExperimentalApi com.atlassian.fugue.Option<GlobalPermissionType> getGlobalPermission(@Nonnull String permissionKey)
permissionKey
- the key of the permission declared by global permission module.@Deprecated boolean addPermission(int permissionType, String group)
addPermission(com.atlassian.jira.permission.GlobalPermissionType, String)
instead.permissionType
- the global permission id.group
- the name of the group. Null means "anyone" group.
The JIRA use, admin and sysadmin permission cannot be granted to anyone.@ExperimentalApi boolean addPermission(@Nonnull GlobalPermissionType globalPermissionType, String group)
globalPermissionType
- global permission, must not be null.group
- the name of the group. Null means "anyone" group.
The JIRA use, admin and sysadmin permission cannot be granted to "anyone".Collection<JiraPermission> getPermissions(int permissionType)
getPermissions(com.atlassian.jira.permission.GlobalPermissionKey)
instead.JiraPermission
contains a reference to the user group.
JiraPermission.getScheme()
is always NULL, because Global permission are not configured using schemes.
JiraPermission.getType()
will always return "group", because global permissions can only be granted to groups.
permissionType
- The key of pluggable global permission. Must be a global permission.JiraPermission.getPermType()
, must never return null.@Internal Collection<GlobalPermissionEntry> getPermissions(GlobalPermissionType globalPermissionType)
getPermissions(com.atlassian.jira.permission.GlobalPermissionKey)
instead. Since v6.2.5.JiraPermission
contains a reference to the user group.
JiraPermission.getScheme()
is always NULL, because Global permission are not configured using schemes.
JiraPermission.getType()
will always return "group", because global permissions can only be granted to groups.
globalPermissionType
- global permission, must not be null.JiraPermission.getPermType()
, must never return null.@ExperimentalApi @Nonnull Collection<GlobalPermissionEntry> getPermissions(@Nonnull GlobalPermissionKey globalPermissionKey)
The returned GlobalPermissionEntry
contains a reference to the user group.
globalPermissionKey
- global permission, must not be null.GlobalPermissionEntry
, never null.boolean removePermission(int permissionType, String group)
removePermission(com.atlassian.jira.permission.GlobalPermissionType, String)
instead.permissionType
- the global permission.group
- the group name. NULL means the anyone group.@ExperimentalApi boolean removePermission(GlobalPermissionType globalPermissionType, String group)
globalPermissionType
- global permission, must not be null.group
- the group name. NULL means the anyone group.boolean removePermissions(@Nonnull String group)
group
- cannot NOT be null and the group must exist.boolean hasPermission(int permissionType)
hasPermission(com.atlassian.jira.permission.GlobalPermissionKey, com.atlassian.jira.user.ApplicationUser)
instead.
If the permission is Permissions.ADMINISTER
and the lookup is false then the same
query will be executed for the Permissions.SYSTEM_ADMIN
permission type, since
it is implied that having a Permissions.SYSTEM_ADMIN
permission grants
Permissions.ADMINISTER
rights.
Note: Use hasPermission(int, ApplicationUser)
method is you have the user object,
i.e. user is not anonymous.
If you are using this method directly, consider using
PermissionManager.hasPermission(int, ApplicationUser)
instead as it handles logged in and anonymous users as well.
permissionType
- must be global permissionhasPermission(int, ApplicationUser)
@Internal boolean hasPermission(@Nonnull GlobalPermissionType globalPermissionType)
hasPermission(com.atlassian.jira.permission.GlobalPermissionKey, com.atlassian.jira.user.ApplicationUser)
instead. Since v6.2.5.boolean hasPermission(int permissionType, ApplicationUser user)
hasPermission(com.atlassian.jira.permission.GlobalPermissionKey, com.atlassian.jira.user.ApplicationUser)
instead.
If the permission type is Permissions.ADMINISTER
and the lookup is false then the same
query will be executed for the Permissions.SYSTEM_ADMIN
permission type, since
it is implied that having a Permissions.SYSTEM_ADMIN
permission grants
Permissions.ADMINISTER
rights.
Note: Use hasPermission(int)
method is you do not have the user object, i.e. user is anonymous.
If you are using this method directly, consider using
PermissionManager.hasPermission(int, ApplicationUser)
instead as it handles logged in and anonymous users as well.
permissionType
- must be a global permissionuser
- must not be nullhasPermission(int)
,
PermissionManager.hasPermission(int, ApplicationUser)
@Internal boolean hasPermission(@Nonnull GlobalPermissionType globalPermissionType, @Nullable ApplicationUser user)
hasPermission(com.atlassian.jira.permission.GlobalPermissionKey, com.atlassian.jira.user.ApplicationUser)
instead. Since v6.2.5.@ExperimentalApi boolean hasPermission(@Nonnull GlobalPermissionKey globalPermissionKey, @Nullable ApplicationUser user)
If the permission type is GlobalPermissionKey.ADMINISTER
and the lookup is false then the same
query will be executed for the GlobalPermissionKey.SYSTEM_ADMIN
permission type, since
it is implied that having a GlobalPermissionKey.SYSTEM_ADMIN
permission grants
GlobalPermissionKey.ADMINISTER
rights.
globalPermissionKey
- global permission, must not be null.user
- The user - can be null indicating "anonymous"Collection<com.atlassian.crowd.embedded.api.Group> getGroupsWithPermission(int permissionId)
permissionId
- must be a global permissionGroup
's, will never be null.@Internal Collection<com.atlassian.crowd.embedded.api.Group> getGroupsWithPermission(@Nonnull GlobalPermissionType globalPermissionType)
getGroupsWithPermission(com.atlassian.jira.permission.GlobalPermissionKey)
instead. Since v6.2.5.globalPermissionType
- global permission, must not be null.Group
's, will never be null.@ExperimentalApi @Nonnull Collection<com.atlassian.crowd.embedded.api.Group> getGroupsWithPermission(@Nonnull GlobalPermissionKey permissionKey)
Only groups directly associated with the permission will be returned.
permissionKey
- global permission, must not be null.Group
's, will never be null.@Nonnull Collection<String> getGroupNames(int permissionId)
permissionId
- must be a global permission@Internal Collection<String> getGroupNames(@Nonnull GlobalPermissionType globalPermissionType)
getGroupNamesWithPermission(com.atlassian.jira.permission.GlobalPermissionKey)
instead. Since v6.2.5.globalPermissionType
- global permission, must not be null.@ExperimentalApi @Nonnull Collection<String> getGroupNamesWithPermission(@Nonnull GlobalPermissionKey permissionKey)
permissionKey
- global permission, must not be null.@ExperimentalApi boolean isGlobalPermission(int permissionId)
GlobalPermissionKey
instead of int
. Since v6.2.5permissionId
- id of the permission to check.@Internal void clearCache()
@Internal boolean isPermissionManagedByJira(@Nonnull GlobalPermissionKey permissionKey)
permissionKey
- global permissionCopyright © 2002-2017 Atlassian. All Rights Reserved.