Class PermissionsResource
- java.lang.Object
-
- com.atlassian.confluence.functest.rest.admin.PermissionsResource
-
public class PermissionsResource extends Object
Modifies space and global permission settings.Preferred way to invoke this from tests: com.atlassian.confluence.test.rest.api.PermissionsRest in confluence-test-utils.
Legacy alternative way to invoke this: com.atlassian.confluence.it.rpc.delegates.admin.PermissionsRpc via com.atlassian.confluence.it.rpc.ConfluenceRpc.
Please maintain both of the above clients if modifying this class.
Permission requirements: must be sysadmin to call this.
TODO: update this to use api SpacePermissionService instead of SpacePermissionManager, once implemented.
- Since:
- 5.9
-
-
Constructor Summary
Constructors Constructor Description PermissionsResource(SpacePermissionManager spacePermissionManager, SpaceManager spaceManager, UserAccessor userAccessor, com.atlassian.sal.api.rdbms.TransactionalExecutorFactory transactionalExecutorFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
changeGlobalPermissions(List<SubjectPermissionChange> permissionChanges)
Enable or disable one or more global permissions for one or more groups, users, or anonymous.void
changeGlobalUnlicensedAuthenticatedPermissions(List<PermissionChange> permissionChanges)
Enable or disable one or more global permissions for unlicensed authenticated users.void
changeSpacePermissions(String spaceKey, List<SubjectPermissionChange> permissionChanges)
Enable or disable one or more space permissions for one or more groups, users, or anonymous.void
changeSpaceUnlicensedAuthenticatedPermissions(String spaceKey, List<PermissionChange> permissionChanges)
Enable or disable one or more space permissions for unlicensed authenticated users.void
deprecatedChangeGlobalAnonymousPermission(String permission, boolean enabled)
Deprecated.since 5.9.void
deprecatedChangeGlobalGroupPermission(String groupName, String permission, boolean enabled)
Deprecated.since 5.9.void
deprecatedChangeGlobalUnlicensedAuthenticatedPermission(String permission, boolean enabled)
Deprecated.since 5.9.void
deprecatedChangeGlobalUserPermissionByUsername(String userName, String permission, boolean enabled)
Deprecated.since 5.9.void
deprecatedChangeSpaceAnonymousPermission(String spaceKey, String permission, boolean enabled)
Deprecated.since 5.9.void
deprecatedChangeSpaceGroupPermission(String spaceKey, String groupName, String permission, boolean enabled)
Deprecated.since 5.9.void
deprecatedChangeSpaceUnlicensedAuthenticatedPermission(String spaceKey, String permission, boolean enabled)
Deprecated.since 5.9.void
deprecatedChangeSpaceUserPermissionByUsername(String spaceKey, String userName, String permission, boolean enabled)
Deprecated.since 5.9.void
revokeAllGlobalPermissions(Subject subject)
Revoke all global permissions for a group, user, or anonymous.void
revokeAllGlobalUnlicensedAuthenticatedPermissions()
Revoke all global permissions for unlicensed authenticated users.void
revokeAllSpacePermissions(String spaceKey, Subject subject)
Revoke all permissions on a space for a user, group or anonymous.void
revokeAllSpaceUnlicensedAuthenticatedPermissions(String spaceKey)
Revoke all permissions on a space for unlicensed authenticated users.
-
-
-
Constructor Detail
-
PermissionsResource
public PermissionsResource(@Qualifier("spacePermissionManager") SpacePermissionManager spacePermissionManager, SpaceManager spaceManager, UserAccessor userAccessor, com.atlassian.sal.api.rdbms.TransactionalExecutorFactory transactionalExecutorFactory)
- Parameters:
spacePermissionManager
- the top-level SpacePermissionManager: note this is wrapped with SpacePermissionCoordinator, which does its own permission checks, but calling user has to be sysadmin anyway
-
-
Method Detail
-
changeGlobalPermissions
public void changeGlobalPermissions(List<SubjectPermissionChange> permissionChanges)
Enable or disable one or more global permissions for one or more groups, users, or anonymous.- Parameters:
permissionChanges
- the changes to apply. Any permissions not specified will not be changed.
-
revokeAllGlobalPermissions
public void revokeAllGlobalPermissions(Subject subject)
Revoke all global permissions for a group, user, or anonymous.- Parameters:
subject
- the subject whose global permissions should be revoked
-
changeGlobalUnlicensedAuthenticatedPermissions
public void changeGlobalUnlicensedAuthenticatedPermissions(List<PermissionChange> permissionChanges)
Enable or disable one or more global permissions for unlicensed authenticated users.- Parameters:
permissionChanges
- the changes to apply. Any permissions not specified will not be changed.
-
revokeAllGlobalUnlicensedAuthenticatedPermissions
public void revokeAllGlobalUnlicensedAuthenticatedPermissions()
Revoke all global permissions for unlicensed authenticated users.
-
changeSpacePermissions
public void changeSpacePermissions(String spaceKey, List<SubjectPermissionChange> permissionChanges)
Enable or disable one or more space permissions for one or more groups, users, or anonymous.- Parameters:
permissionChanges
- the changes to apply. Any permissions not specified will not be changed.
-
revokeAllSpacePermissions
public void revokeAllSpacePermissions(String spaceKey, Subject subject)
Revoke all permissions on a space for a user, group or anonymous.- Parameters:
subject
- the subject whose global permissions should be revoked
-
changeSpaceUnlicensedAuthenticatedPermissions
public void changeSpaceUnlicensedAuthenticatedPermissions(String spaceKey, List<PermissionChange> permissionChanges)
Enable or disable one or more space permissions for unlicensed authenticated users.- Parameters:
permissionChanges
- the changes to apply. Any permissions not specified will not be changed.
-
revokeAllSpaceUnlicensedAuthenticatedPermissions
public void revokeAllSpaceUnlicensedAuthenticatedPermissions(String spaceKey)
Revoke all permissions on a space for unlicensed authenticated users.
-
deprecatedChangeGlobalGroupPermission
@Deprecated public void deprecatedChangeGlobalGroupPermission(String groupName, String permission, boolean enabled)
Deprecated.since 5.9. UsechangeGlobalPermissions(java.util.List<com.atlassian.confluence.functest.rest.admin.model.SubjectPermissionChange>)
instead, which better supports special characters in group names. This method is only here to support the tiny range of confluence-test-utils PermissionsRest versions that called it, and can eventually be removed.
-
deprecatedChangeGlobalUserPermissionByUsername
@Deprecated public void deprecatedChangeGlobalUserPermissionByUsername(String userName, String permission, boolean enabled)
Deprecated.since 5.9. UsechangeGlobalPermissions(java.util.List<com.atlassian.confluence.functest.rest.admin.model.SubjectPermissionChange>)
instead, which better supports special characters in user names. This method is only here to support the tiny range of confluence-test-utils PermissionsRest versions that called it, and can eventually be removed.
-
deprecatedChangeGlobalUnlicensedAuthenticatedPermission
@Deprecated public void deprecatedChangeGlobalUnlicensedAuthenticatedPermission(String permission, boolean enabled)
Deprecated.since 5.9. UsechangeGlobalUnlicensedAuthenticatedPermissions(java.util.List<com.atlassian.confluence.functest.rest.admin.model.PermissionChange>)
instead. This method is only here to support the tiny range of confluence-test-utils PermissionsRest versions that called it, and can eventually be removed.
-
deprecatedChangeGlobalAnonymousPermission
@Deprecated public void deprecatedChangeGlobalAnonymousPermission(String permission, boolean enabled)
Deprecated.since 5.9. UsechangeGlobalPermissions(java.util.List<com.atlassian.confluence.functest.rest.admin.model.SubjectPermissionChange>)
instead. This method is only here to support the tiny range of confluence-test-utils PermissionsRest versions that called it, and can eventually be removed.
-
deprecatedChangeSpaceGroupPermission
@Deprecated public void deprecatedChangeSpaceGroupPermission(String spaceKey, String groupName, String permission, boolean enabled)
Deprecated.since 5.9. UsechangeSpacePermissions(java.lang.String, java.util.List<com.atlassian.confluence.functest.rest.admin.model.SubjectPermissionChange>)
instead, which better supports special characters in group names. This method is only here to support the tiny range of confluence-test-utils PermissionsRest versions that called it, and can eventually be removed.
-
deprecatedChangeSpaceUserPermissionByUsername
@Deprecated public void deprecatedChangeSpaceUserPermissionByUsername(String spaceKey, String userName, String permission, boolean enabled)
Deprecated.since 5.9. UsechangeSpacePermissions(java.lang.String, java.util.List<com.atlassian.confluence.functest.rest.admin.model.SubjectPermissionChange>)
instead, which better supports special characters in user names. This method is only here to support the tiny range of confluence-test-utils PermissionsRest versions that called it, and can eventually be removed.
-
deprecatedChangeSpaceUnlicensedAuthenticatedPermission
@Deprecated public void deprecatedChangeSpaceUnlicensedAuthenticatedPermission(String spaceKey, String permission, boolean enabled)
Deprecated.since 5.9. UsechangeSpaceUnlicensedAuthenticatedPermissions(java.lang.String, java.util.List<com.atlassian.confluence.functest.rest.admin.model.PermissionChange>)
instead. This method is only here to support the tiny range of confluence-test-utils PermissionsRest versions that called it, and can eventually be removed.
-
deprecatedChangeSpaceAnonymousPermission
@Deprecated public void deprecatedChangeSpaceAnonymousPermission(String spaceKey, String permission, boolean enabled)
Deprecated.since 5.9. UsechangeSpacePermissions(java.lang.String, java.util.List<com.atlassian.confluence.functest.rest.admin.model.SubjectPermissionChange>)
instead. This method is only here to support the tiny range of confluence-test-utils PermissionsRest versions that called it, and can eventually be removed.
-
-