Is there a way to bulk move users from one group to another?
Asked by Steve Goldberg:

We recently implemented LDAP and there is significant overlap between our users in the confluence internal directory and our active directory. While we're happy to make the 'switch' and lower the priority of the internal directory below the active directory, this will cause issues as our group names do not match exactly.

For example, we have a group in our internal directory called "staff" which contains all our staff members (as opposed to a group called "client", which contains just about everyone else) but in our active directory, this group is called "all-staff".

When we swap the order of the directories, the "staff" group (that we've applied to just about every space) that we set up will be useless as all our staff users will be in the "all-staff" group.

I have two questions, one of which I hope we can do:

1. Can we bulk move the active directory users in the "all-staff" group to the "staff" group? OR
2. Can we bulk change the group permissions (or rename?) the space permissions from "staff" to "all-staff"?

Thanks


Answers:
author: AndrewA
body: allo,  
There is no pretty way to do this via the UI but I believe we could bulk change the permissiosn via the database. The following SQL would change all permission entries for the group 'staff' and make them for 'all-staff'. Please keep in mind, this would be for ALL permissions that were specific to the 'staff' group across the entire instance of Confluence. Furthermore, I have not tested this against antying other then a small local instance. With that in mind, I highly suggest trying this in a test environment first and be sure to create a backup of the DB first.

UPDATE SPACEPERMISSIONS SET PERMGROUPNAME='all-staff' where PERMGROUPNAME='staff';

Cheers,  
Andrew

P.S make sure Confluence is off when making these changes.

comments: author: Steve Goldberg
body: Thanks! I'll try it out.


author: BernardoA
body: Reading this question I found some imporvement requests which informs similiar request that are still under analysis:

<https://jira.atlassian.com/browse/CONF-26594>

<https://jira.atlassian.com/browse/JRA-4138>

<https://jira.atlassian.com/browse/JRA-3174>

comments: author: mickyd
body: JIRA *Improvement Request portal*....where requests go to die.


author: Ignacio Sebriano
body: Hi community,

Just in case. The one that worked for me was to copy the users from a sql query result and save it as a CSV file, then copy all the users from that CSV and add them to the group from JIRA using the normal procedure.


author: Alexey Matveev
body: Hello,

You could also do it with the Power Scripts for Confluence add-on:

[https://marketplace.atlassian.com/apps/1219507/power-scripts-for-confluence?hosting=server\&tab=overview](https://marketplace.atlassian.com/apps/1219507/power-scripts-for-confluence?hosting=server&tab=overview)

It is a free add-on. Here is the script you need:

    string[] users = usersInGroups({"remove group name"});

    for(number i = 0; i < size(users); i = i + 1) {
      removeUserFromGroup(users[i], "remove group name");
      addUserToGroup(users[i], "add group name");
    }


Tags: active-directory

bulk-edit

group

permission

user-management