Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,359,955
Community Members
 
Community Events
168
Community Groups

Scriptrunner add LDAP user to group

 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

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)

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Online AMA this week: Your project management questions answered by Jira Design Lead James Rotanson

We know that great teams require amazing project management chops. It's no surprise that great teams who use Jira have strong project managers, effective workflows, and secrets that bring planning ...

179 views 1 6
Read article

Atlassian Community Events