public interface UserPermissionService
Modifier and Type | Method and Description |
---|---|
boolean |
currentUserHasPermission(UserPermission permission)
Does the current user have the provided permission.
|
Set<User> |
getGroupLevelAdmins(boolean considerOnlyTargetGroupsWithApplications) |
default Set<User> |
getSysAdmins(Application application,
boolean includeLocallyCachedOnly) |
Set<User> |
getUsersWithPermission(Application application,
UserPermission userPermission,
boolean includeLocallyCachedOnly) |
boolean |
hasPermission(String username,
UserPermission permission)
Does the provided user have the provided permission.
|
boolean |
hasPermissionOutsideOfGroups(String username,
UserPermission permission,
Collection<DirectoryGroup> excludedGroups)
Does the provided user have the provided permission when not considering the provided groups.
|
boolean |
isGroupLevelAdmin(String username)
Does the provided user have Group Level Admin permissions.
|
boolean currentUserHasPermission(UserPermission permission)
permission
- permission requiredboolean hasPermission(@Nullable String username, UserPermission permission)
username
- user to check, null for the anonymous userpermission
- permission requiredboolean hasPermissionOutsideOfGroups(@Nullable String username, UserPermission permission, Collection<DirectoryGroup> excludedGroups)
This method is intended to be used to determine if a group is exclusively providing a given permission.
username
- user to check, null for the anonymous userpermission
- permission requiredexcludedGroups
- groups to exclude in permission check, or an empty list otherwiseboolean isGroupLevelAdmin(@Nullable String username)
username
- user to check, null for anonymous user@ExperimentalApi default Set<User> getSysAdmins(Application application, boolean includeLocallyCachedOnly) throws DirectoryNotFoundException, OperationFailedException
application
- application the permission applies toincludeLocallyCachedOnly
- if set to true will limit search to users stored locallyDirectoryNotFoundException
OperationFailedException
@ExperimentalApi Set<User> getUsersWithPermission(Application application, UserPermission userPermission, boolean includeLocallyCachedOnly) throws DirectoryNotFoundException, OperationFailedException
application
- application the permission applies touserPermission
- permission to checkincludeLocallyCachedOnly
- if set to true will limit search to users stored locallyDirectoryNotFoundException
OperationFailedException
@ExperimentalApi Set<User> getGroupLevelAdmins(boolean considerOnlyTargetGroupsWithApplications) throws DirectoryNotFoundException, OperationFailedException
considerOnlyTargetGroupsWithApplications
- whether groups without any active application should be taken into accountDirectoryNotFoundException
OperationFailedException
Copyright © 2020 Atlassian. All rights reserved.