Interface UserPermissionService
public interface UserPermissionService
Check Crowd access permissions for users, eg SYS_ADMIN and ADMIN.
-
Method Summary
Modifier and TypeMethodDescriptionbooleancurrentUserHasPermission(UserPermission permission) Does the current user have the provided permission.getGroupLevelAdmins(boolean considerOnlyTargetGroupsWithApplications) getSysAdmins(Application application, boolean includeLocallyCachedOnly) getUsersWithPermission(Application application, UserPermission userPermission, boolean includeLocallyCachedOnly) booleanhasPermission(String username, UserPermission permission) Does the provided user have the provided permission.booleanhasPermissionOutsideOfGroups(String username, UserPermission permission, Collection<DirectoryGroup> excludedGroups) Does the provided user have the provided permission when not considering the provided groups.booleanisGroupLevelAdmin(String username) Does the provided user have Group Level Admin permissions.
-
Method Details
-
currentUserHasPermission
Does the current user have the provided permission.- Parameters:
permission- permission required- Returns:
- true if the user has permission
-
hasPermission
Does the provided user have the provided permission.- Parameters:
username- user to check, null for the anonymous userpermission- permission required- Returns:
- true if the user has permission
-
hasPermissionOutsideOfGroups
boolean hasPermissionOutsideOfGroups(@Nullable String username, UserPermission permission, Collection<DirectoryGroup> excludedGroups) Does the provided user have the provided permission when not considering the provided groups.This method is intended to be used to determine if a group is exclusively providing a given permission.
- Parameters:
username- user to check, null for the anonymous userpermission- permission requiredexcludedGroups- groups to exclude in permission check, or an empty list otherwise- Returns:
- true if the user has permission outside of the provided groups
-
isGroupLevelAdmin
Does the provided user have Group Level Admin permissions.- Parameters:
username- user to check, null for anonymous user- Returns:
- true if the user has Group Level Admin permissions
-
getSysAdmins
@ExperimentalApi default Set<User> getSysAdmins(Application application, boolean includeLocallyCachedOnly) throws DirectoryNotFoundException, OperationFailedException - Parameters:
application- application the permission applies toincludeLocallyCachedOnly- if set to true will limit search to users stored locally- Returns:
- users with SYS_ADMIN permission.
- Throws:
DirectoryNotFoundExceptionOperationFailedException
-
getUsersWithPermission
@ExperimentalApi Set<User> getUsersWithPermission(Application application, UserPermission userPermission, boolean includeLocallyCachedOnly) throws DirectoryNotFoundException, OperationFailedException - Parameters:
application- application the permission applies touserPermission- permission to checkincludeLocallyCachedOnly- if set to true will limit search to users stored locally- Returns:
- users with the given permission
- Throws:
DirectoryNotFoundExceptionOperationFailedException- Since:
- 3.7
-
getGroupLevelAdmins
@ExperimentalApi Set<User> getGroupLevelAdmins(boolean considerOnlyTargetGroupsWithApplications) throws DirectoryNotFoundException, OperationFailedException - Parameters:
considerOnlyTargetGroupsWithApplications- whether groups without any active application should be taken into account- Returns:
- users with group level admin permission.
- Throws:
DirectoryNotFoundExceptionOperationFailedException
-