@ExperimentalApi
public interface GlobalPermissionService
GlobalPermissionType
Modifier and Type | Method and Description |
---|---|
void |
addGroupPermission(java.lang.String group,
GlobalPermissionType permission)
Adds
permission to given group . |
boolean |
addUserPermission(java.lang.String userName,
GlobalPermissionType permission)
Adds
permission to given userName . |
Page<java.lang.String> |
getGroupNames(GlobalPermissionSearchCriteria searchCriteria,
PageRequest pageRequest)
Returns a page of group names, optionally filtered by
searchCriteria . |
java.util.Map<java.lang.String,java.util.Set<GlobalPermissionType>> |
getGroupPermissions(java.lang.Iterable<java.lang.String> groupNames)
Returns a map from group name to set of global permissions associated with that group for all
groupNames . |
Page<java.lang.String> |
getUserNames(GlobalPermissionSearchCriteria searchCriteria,
PageRequest pageRequest)
Returns a page of user names, optionally filtered by
searchCriteria . |
java.util.Map<java.lang.String,java.util.Set<GlobalPermissionType>> |
getUserPermissions(java.lang.Iterable<java.lang.String> userNames)
Returns a map from user name to set of global permissions associated with that user for all
userNames . |
boolean |
hasUserPermissions(Principal user,
GlobalPermissionType permission) |
boolean |
hasUserPermissions(java.lang.String userName,
GlobalPermissionType permission) |
void |
removeAllPermissionsForGroup(java.lang.String group)
Removes all permissions from
group |
boolean |
removeAllPermissionsForUser(java.lang.String userName)
Removes all permissions from
userName |
void |
removeGroupPermission(java.lang.String group,
GlobalPermissionType permission)
Removes
permission from group . |
boolean |
removeUserPermission(java.lang.String userName,
GlobalPermissionType permission)
Removes
permission from userName . |
boolean hasUserPermissions(java.lang.String userName, GlobalPermissionType permission) throws java.lang.IllegalArgumentException
userName
exists and has given permissions
java.lang.IllegalArgumentException
- if no username specifiedboolean hasUserPermissions(Principal user, GlobalPermissionType permission) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- if user.getUserName()
returns nullvoid addGroupPermission(java.lang.String group, GlobalPermissionType permission) throws java.lang.IllegalArgumentException, NotPermittedException
permission
to given group
.
No-op if such a permission already exists.java.lang.IllegalArgumentException
- if group
doesn't existNotPermittedException
- if caller does not have admin permissions.void removeGroupPermission(java.lang.String group, GlobalPermissionType permission) throws java.lang.IllegalArgumentException, NotPermittedException
permission
from group
.
No-op if such a permission does not exist.java.lang.IllegalArgumentException
- if group
doesn't existNotPermittedException
- if caller does not have admin permissions.void removeAllPermissionsForGroup(java.lang.String group) throws java.lang.IllegalArgumentException, NotPermittedException
group
java.lang.IllegalArgumentException
- if group
doesn't existNotPermittedException
- if caller does not have admin permissions.Page<java.lang.String> getGroupNames(@Nullable GlobalPermissionSearchCriteria searchCriteria, PageRequest pageRequest) throws NotPermittedException
searchCriteria
.NotPermittedException
- if caller does not have admin permissions.java.util.Map<java.lang.String,java.util.Set<GlobalPermissionType>> getGroupPermissions(java.lang.Iterable<java.lang.String> groupNames) throws java.lang.IllegalArgumentException, NotPermittedException
groupNames
.
If a group has no permissions, the map will still contain an entry, where value is an empty set.NotPermittedException
- if caller does not have admin permissions.java.lang.IllegalArgumentException
- if groupNames
is null or emptygetGroupNames(com.atlassian.crucible.spi.services.GlobalPermissionSearchCriteria, com.atlassian.fecru.page.PageRequest)
boolean addUserPermission(java.lang.String userName, GlobalPermissionType permission) throws java.lang.IllegalArgumentException, NotPermittedException
permission
to given userName
.
No-op if such a permission already exists.java.lang.IllegalArgumentException
- if userName
doesn't existNotPermittedException
- if caller does not have admin permissions.boolean removeUserPermission(java.lang.String userName, GlobalPermissionType permission) throws java.lang.IllegalArgumentException, NotPermittedException
permission
from userName
.
No-op if such a permission does not exist.java.lang.IllegalArgumentException
- if userName
doesn't existNotPermittedException
- if caller does not have admin permissions.boolean removeAllPermissionsForUser(java.lang.String userName) throws java.lang.IllegalArgumentException, NotPermittedException
userName
java.lang.IllegalArgumentException
- if userName
doesn't existNotPermittedException
- if caller does not have admin permissions.Page<java.lang.String> getUserNames(@Nullable GlobalPermissionSearchCriteria searchCriteria, PageRequest pageRequest) throws NotPermittedException
searchCriteria
.NotPermittedException
- if caller does not have admin permissions.java.util.Map<java.lang.String,java.util.Set<GlobalPermissionType>> getUserPermissions(java.lang.Iterable<java.lang.String> userNames) throws java.lang.IllegalArgumentException, NotPermittedException
userNames
.
If a user has no permissions, the map will still contain an entry, where value is an empty set.NotPermittedException
- if caller does not have admin permissions.java.lang.IllegalArgumentException
- if userNames
is null or emptygetUserNames(com.atlassian.crucible.spi.services.GlobalPermissionSearchCriteria, com.atlassian.fecru.page.PageRequest)