Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to add a used to a specific role in a group

Lisa Sun September 11, 2023
projectRoleService.addActorsToProjectRole() is a deprecated function. Is there another way to add a user into a specific group with a specific role?
I am currently only able to add users to groups but am unable to dictate their roles.

GroupManager groupManager = ComponentAccessor.getGroupManager()
Group group = groupManager.getGroup("your-group-name")
ApplicationUser userToAdd = ComponentAccessor.getUserManager().getUserByName("your-username"
groupManager.addUserToGroup(userToAdd, group)

1 answer

0 votes
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 11, 2023

Welcome to the Atlassian Community!

I am not sure I understand the question.  Are you trying to add a user to a group or a role?

Suggest an answer

Log in or Sign up to answer