You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hi,
I'm trying to create a script that will remove space permissions of inactive users.
This is what I got so far:
import com.atlassian.spring.container.ContainerManager;
import com.atlassian.confluence.user.UserAccessor;
import com.atlassian.confluence.user.ConfluenceUser;
import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.confluence.internal.security.SpacePermissionManagerInternal;
import com.atlassian.confluence.spaces.SpaceManager
import com.atlassian.confluence.internal.security.SpacePermissionContext;
UserAccessor userAccessor = (UserAccessor) ContainerManager.getComponent("userAccessor");
def spaceManager = ComponentLocator.getComponent(SpaceManager)
def spacePermissionManager = ComponentLocator.getComponent(SpacePermissionManagerInternal)
def user = userAccessor.getUserByName('<username>')
SpacePermissionContext context = SpacePermissionContext.builder().build()
spacePermissionManager.removeAllUserPermissions(user, context);
But the script does nothing at the moment. Does anyone know how to remove space permissions of a user?
best regards,
Filip
Hi Filip!
The SpacePermissionManager removeAllUserPermissions() method is used to remove individual space permissions from the specified user.
This means that if a user is a space administrator of 'Space A' then removeAllUserPermissions('example_user') would remove their individual administrator permissions for any space within your instance, but it would not remove any permissions that receive from a Confluence group they belong to.
To do this you will need to remove the inactive user from any Confluence groups they belong to. We have an example script that displays how you can remove specified users from a group here.
Kind regards,
Lee
Removing individual space permissions not given by groups would still be nice to know how. Since these are easily forgotten, and sometimes added ad hoc.
Essentially for longer instances of confluence many "individual" rights till exist on spaces even after they have lone gone from the company.
Also would be useful for any IDM project.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.