Interface EditPermissionsAdministrator
-
- All Superinterfaces:
PermissionsAdministrator
- All Known Implementing Classes:
AbstractEditPermissionsAdministrator
,AbstractEditPermissionsAdministrator
,EditGlobalPermissionsAdministrator
,EditGlobalPermissionsAdministrator
,EditSpacePermissionsAdministrator
,EditSpacePermissionsAdministrator
public interface EditPermissionsAdministrator extends PermissionsAdministrator
Provides the logic required by the actions to edit the permissions for both global and spaces
-
-
Field Summary
Fields Modifier and Type Field Description static Integer
MAX_ENTRIES
the max number of entries for adding groups or users to permission scheme.
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
addAllPermissions(Set<SpacePermission> permissionsToAdd)
Adds the given set of permissions if the current user has permission to do so, otherwise does nothing silently.List<String>
addGuardPermissionToGroups(List<String> groupNames, UserAccessor userAccessor, String guardPermission)
Deprecated.since 7.17List<String>
addGuardPermissionToGroups(List<String> groupNames, String guardPermission)
Add the guard permissions for each group if they existList<String>
addGuardPermissionToUsers(List<String> userNames, UserAccessor userAccessor, String guardPermission)
Deprecated.since 7.17List<String>
addGuardPermissionToUsers(List<String> userNames, String guardPermission)
Add the guard permissions for each user if they existvoid
addPermission(SpacePermission permissionToAdd)
Adds the given permission if the current user has permission to do so, otherwise does nothing silently.void
applyPermissionChanges(Collection<SpacePermission> oldPermissions, Collection<SpacePermission> newPermissions)
Given the old permissions and new permissions, apply necessary permission changes to make old permissions the same as new permissionsCollection<SpacePermission>
buildPermissionsFromWebForm(Map formParameters, String parameterQualifier)
Given a map containing the web form parameters from a permissions edit, return the list of global permissions that are represented by the formSpacePermission
createGroupGuardPermission(String guardPermission, String groupName)
Creates the relevant guard permission for the groupSpacePermission
createUserGuardPermission(String guardPermission, ConfluenceUser user)
Creates the relevant guard permission for the uservoid
denyAnonymousPermissions(Collection<SpacePermission> currentPermissions, Set<SpacePermission> permissionsToAdd, Set<SpacePermission> permissionsToRemove)
Deprecated.since 5.9, with no replacementString
getAdministrativePermissionType()
Returns the top level permission type applicable to the current scope.Collection<SpacePermission>
getInitialPermissionsFromForm(Map requestParams)
Retrieve the permissions initial stateint
getNumOfGroupEntries()
Returns the number of group entries that are to be added.int
getNumOfUserEntries()
Returns the number of user entries that are to be added.Collection<SpacePermission>
getRequestedPermissionsFromForm(Map requestParams)
Retrieve the state of the permissions requested by the userboolean
isGroupsToAddEmpty(Map requestParams)
Validate if the number of groups to add is empty Validation only occurs if the group add button is pressedboolean
isGroupsToAddTooLarge(Map requestParams)
Validate if the number of groups to add is greater than maximum allowed.boolean
isRemoveAllAdminPermissions(Set<SpacePermission> permissionsToRemove)
Returns if all admin permissions would be removed by the request.boolean
isUsersToAddEmpty(Map requestParams)
Validate if the number of users to add is empty Validation only occurs if the user add button is pressedboolean
isUsersToAddTooLarge(Map requestParams)
Validate if the number of users to add is greater than maximum allowed.void
removeAllPermissions(Set<SpacePermission> permissionsToRemove)
Removes the given set of permissions if the current user has permission to do so, otherwise does nothing silently.void
removePermission(SpacePermission permissionToRemove)
Removes the given permission if the current user has permission to do so, otherwise does nothing silently.void
splitPermissions(Collection<SpacePermission> existingPermissions, Collection<SpacePermission> initialPermissions, Collection<SpacePermission> requestedPermissions, Set<SpacePermission> permissionsToAdd, Set<SpacePermission> permissionsToRemove)
Determine which permissions need to be added or removed.-
Methods inherited from interface com.atlassian.confluence.security.administrators.PermissionsAdministrator
buildAnonymousPermissionRow, buildGroupPermissionTable, buildUnlicensedAuthenticatedPermissionRow, buildUserPermissionTable, getPermissions
-
-
-
-
Field Detail
-
MAX_ENTRIES
static final Integer MAX_ENTRIES
the max number of entries for adding groups or users to permission scheme.
-
-
Method Detail
-
isGroupsToAddTooLarge
boolean isGroupsToAddTooLarge(Map requestParams)
Validate if the number of groups to add is greater than maximum allowed. Validation only occurs if the group add button is pressed- Parameters:
requestParams
- params from the request- Returns:
- true if limit is exceeded.
-
isGroupsToAddEmpty
boolean isGroupsToAddEmpty(Map requestParams)
Validate if the number of groups to add is empty Validation only occurs if the group add button is pressed- Parameters:
requestParams
- params from the request- Returns:
- true if groups are empty
-
getNumOfGroupEntries
int getNumOfGroupEntries()
Returns the number of group entries that are to be added.- Returns:
- the number of group entries that are to be added
-
isUsersToAddTooLarge
boolean isUsersToAddTooLarge(Map requestParams)
Validate if the number of users to add is greater than maximum allowed. Validation only occurs if the user add button is pressed- Parameters:
requestParams
- params from the request- Returns:
- true if limit is exceeded.
-
isUsersToAddEmpty
boolean isUsersToAddEmpty(Map requestParams)
Validate if the number of users to add is empty Validation only occurs if the user add button is pressed- Parameters:
requestParams
- params from the request- Returns:
- true if users are empty
-
getNumOfUserEntries
int getNumOfUserEntries()
Returns the number of user entries that are to be added.- Returns:
- the number of user entries that are to be added
-
buildPermissionsFromWebForm
Collection<SpacePermission> buildPermissionsFromWebForm(Map formParameters, String parameterQualifier)
Given a map containing the web form parameters from a permissions edit, return the list of global permissions that are represented by the form- Parameters:
formParameters
- the map of form parametersparameterQualifier
- distinguishes the set of parameters from other sets of parameters used to represent permissions in the same form.- Returns:
- a list of the permissions in the form
-
splitPermissions
void splitPermissions(Collection<SpacePermission> existingPermissions, Collection<SpacePermission> initialPermissions, Collection<SpacePermission> requestedPermissions, Set<SpacePermission> permissionsToAdd, Set<SpacePermission> permissionsToRemove)
Determine which permissions need to be added or removed. Given a collection of how permissions are now (existingPermissions) and how you wish the permissions to be (newPermissions), this will populate the collectionspermissionsToAdd
andpermissionsToRemove
with those permissions that you will need to add or remove to reach the desired state.- Parameters:
existingPermissions
- the currently existing permissionsinitialPermissions
- the permissions the user was initially shownrequestedPermissions
- the new state we want these permissions to be inpermissionsToAdd
- collection into which permissions that need adding will be placedpermissionsToRemove
- collection into which permissions that need removing will be placed
-
isRemoveAllAdminPermissions
boolean isRemoveAllAdminPermissions(Set<SpacePermission> permissionsToRemove)
Returns if all admin permissions would be removed by the request.- Parameters:
permissionsToRemove
- - permissions to be removed- Returns:
- true if all admin permissions would be removed by the request
-
getInitialPermissionsFromForm
Collection<SpacePermission> getInitialPermissionsFromForm(Map requestParams)
Retrieve the permissions initial state- Returns:
- initial state
-
getRequestedPermissionsFromForm
Collection<SpacePermission> getRequestedPermissionsFromForm(Map requestParams)
Retrieve the state of the permissions requested by the user- Returns:
- requested state
-
denyAnonymousPermissions
@Deprecated void denyAnonymousPermissions(Collection<SpacePermission> currentPermissions, Set<SpacePermission> permissionsToAdd, Set<SpacePermission> permissionsToRemove)
Deprecated.since 5.9, with no replacementRemoves all anonymous permissions- Parameters:
currentPermissions
- - current state of the permissionspermissionsToAdd
- - permissions to be addedpermissionsToRemove
- - permissions to be removed
-
addAllPermissions
void addAllPermissions(Set<SpacePermission> permissionsToAdd)
Adds the given set of permissions if the current user has permission to do so, otherwise does nothing silently.- Parameters:
permissionsToAdd
- the set of permissions you want rid of.
-
addPermission
void addPermission(SpacePermission permissionToAdd)
Adds the given permission if the current user has permission to do so, otherwise does nothing silently.- Parameters:
permissionToAdd
- the permission you want rid of.
-
removeAllPermissions
void removeAllPermissions(Set<SpacePermission> permissionsToRemove)
Removes the given set of permissions if the current user has permission to do so, otherwise does nothing silently.- Parameters:
permissionsToRemove
- the permission you want rid of.
-
removePermission
void removePermission(SpacePermission permissionToRemove)
Removes the given permission if the current user has permission to do so, otherwise does nothing silently.- Parameters:
permissionToRemove
- the permission you want rid of.
-
addGuardPermissionToGroups
List<String> addGuardPermissionToGroups(List<String> groupNames, String guardPermission)
Add the guard permissions for each group if they exist- Parameters:
groupNames
- - names of the groups to be addedguardPermission
- - the name of the guard permission to add- Returns:
- false if an error occurred.
- Since:
- 7.17
-
addGuardPermissionToGroups
@Deprecated List<String> addGuardPermissionToGroups(List<String> groupNames, UserAccessor userAccessor, String guardPermission)
Deprecated.since 7.17Add the guard permissions for each group if they exist- Parameters:
groupNames
- - names of the groups to be addeduserAccessor
- - user accessorguardPermission
- - the name of the guard permission to add- Returns:
- false if an error occurred.
-
addGuardPermissionToUsers
List<String> addGuardPermissionToUsers(List<String> userNames, String guardPermission)
Add the guard permissions for each user if they exist- Parameters:
userNames
- - names of the users to be addedguardPermission
- - the name of the guard permission to add- Returns:
- false if an error occurred.
- Since:
- 7.17
-
addGuardPermissionToUsers
@Deprecated List<String> addGuardPermissionToUsers(List<String> userNames, UserAccessor userAccessor, String guardPermission)
Deprecated.since 7.17Add the guard permissions for each user if they exist- Parameters:
userNames
- - names of the users to be addeduserAccessor
- - user accessorguardPermission
- - the name of the guard permission to add- Returns:
- false if an error occurred.
-
createUserGuardPermission
SpacePermission createUserGuardPermission(String guardPermission, ConfluenceUser user)
Creates the relevant guard permission for the user- Parameters:
guardPermission
- - the name of the guard permission to createuser
- - name of the user to add the permission to- Returns:
- spacepermission object for the user
- Since:
- 5.2
-
createGroupGuardPermission
SpacePermission createGroupGuardPermission(String guardPermission, String groupName)
Creates the relevant guard permission for the group- Parameters:
guardPermission
- - the name of the guard permission to creategroupName
- - name of group to add the permission to- Returns:
- spacepermission object for the user
-
getAdministrativePermissionType
String getAdministrativePermissionType()
Returns the top level permission type applicable to the current scope. That is, the permission that must exist at least once per space, or globally.- Returns:
- top level permission type
-
applyPermissionChanges
void applyPermissionChanges(Collection<SpacePermission> oldPermissions, Collection<SpacePermission> newPermissions)
Given the old permissions and new permissions, apply necessary permission changes to make old permissions the same as new permissions- Parameters:
oldPermissions
- - initial permissionsnewPermissions
- - expected permissions
-
-