The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Scriptrunner add LDAP user to group

Deleted user
October 9, 2018

 if my Jira server user Directory is using LDAP. What will be the best way to :

getUserByName("A"),
addUserToGroup(user,group)

 error:

"message":"org.springframework.transaction.CannotCreateTransactionException: Could not create DirContext instance for transaction; nested exception is org.springframework.ldap.CommunicationException
Root exception is java.lang.ClassNotFoundException: com.atlassian.crowd.directory.ssl.LdapHostnameVerificationSSLSocketFactory

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

1 vote
Vijay Sv
Contributor
May 3, 2021

Try this...

 

import com.atlassian.jira.component.ComponentAccessor

def username = "user1"
def group ="groupA"
def addtouser = ComponentAccessor.getUserManager().getUserByName(username)
def grouptoadd = ComponentAccessor.getUserManager().getGroup(group)

ComponentAccessor.groupManager.addUserToGroup(addtouser,grouptoadd)

TAGS
AUG Leaders

Atlassian Community Events