Up until recently, our Cloud instance was open (to logged-in users). We want to keep our information transparent, and many of our users work in multiple projects.
However, we recently added a team that's part of the organization, but kind of standalone, and we do not want them to be able to see our other projects.
I'm planning on updating our default permission scheme to use a project role for Browse Projects, but don't want to have to update 40+ separate projects with individual users. Ideally, those 40+ projects would have a project role containing a group that in turn contains all users except the new team.
Therein lies the issue: we have almost 500 users in our default access group. What I now need to do is create a copy of that group with 475 users. It would be much easier if I could create a copy of our default group and then just remove the users in question, but I'm not aware of a way to do that. I'm happy to work with the REST API if necessary, since this is going to be a one-off. I'm also happy to temporarily install an add-on if there's one available that will do this.
Any ideas?
Hello @Esther Strom
Thank you for reaching out.
Indeed, I'm afraid Jira does not have an Inbuilt functionality to copy users from one group to another. We have two feature requests that would allow you to configure it:
- Improve Add Users To Group Functionality
Feel free to vote and watch the suggestion to increase its priority and also receive notifications about any updates.
As a workaround, you can create a REST API Script to bulk add your users. These would be the exact steps:
1 - Navigate to your User management > In the Users tab, click in the button "Export Users"
2 - Select the group you want to export the users from and finish the export:
3 - Create a new group in Jira
4 - Create a script using the post command in Jira Cloud REST API to add those users to the new group you created, preferably using a practical text editor that will place that call together with the users you exported:
POST https://yourdomain.atlassian.net/rest/api/3/group/user
Let us know if you have any questions.
Thanks, @Petter Gonçalves
I figured that was the case, but hoped there was something hidden somewhere that would let me do it. API it is.
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.
#region Login
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$user = Read-Host -Prompt 'Input an Admin name: '
$pass = Read-Host -Prompt 'Input the Admin key: '
$pair = "$($user):$($pass)"
$encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))
$basicAuthValue = "Basic $encodedCreds"
$Headers = @{
Authorization = $basicAuthValue
}
#endregion Login
#region remove file
$FileName = ".\users.csv"
if (Test-Path .\*.csv)
{
Remove-Item .\*.csv}
#endregion remove file
#region get id's from group
$groupFrom = Read-Host -Prompt 'Input group name to copy users from '
$groupMembers = [uri]::EscapeUriString($groupFrom)
$URL = "https://<>.atlassian.net/rest/api/3/group/member?groupname=$groupMembers"
do{
$x = (((Invoke-WebRequest -UseBasicParsing -Method GET -Uri $URL -Headers $headers -SessionVariable session -ContentType 'application/json').Content) | ConvertFrom-Json)
Out-File -FilePath $FileName -InputObject $($x.values.accountId) -Append
if($x.isLast -ne "true"){
$URL = $x.nextPage
$x1 = (((Invoke-WebRequest -UseBasicParsing -Method GET -Uri $URL -Headers $headers -SessionVariable session -ContentType 'application/json').Content) | ConvertFrom-Json)
Out-File -FilePath $FileName -InputObject $($x1.values.accountId) -Append
}
}while($x.isLast -ne "true")
#endregion get id's from group
#region copy to group
$groupTo = Read-Host -Prompt 'Input group name to copy users to '
$group = [uri]::EscapeUriString($groupTo)
$FileName = Get-Content users.csv
foreach ($ID in $FileName) {
Invoke-WebRequest -Headers $headers -Method POST -Body (@{"accountId"="$($ID)";}|ConvertTo-Json) -Uri https://<>.atlassian.net/rest/api/3/group/user?groupname=$group -ContentType application/json
}
#endregion copy to group
exit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here's a powershell script I've written up which does the trick for me. Simply just prompts the user for a group name and then grabs the ID's from that group to a file named "users.csv" in the same directory. It will then prompt for the group to add the users to and iterate over the file one by one. Hope this helps someone.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
-edit- nevermind i needed to set the domain name -edit-
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.