You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I was able to successfully setup the ldap connection but when I tried to run the sample script:
import com.onresolve.scriptrunner.ldap.LdapUtil
def cnList = LdapUtil.withTemplate('corporate') {
template -> template.search("", "(sn=Smi*)", SearchControls.SUBTREE_SCOPE, { attributes ->
attributes.get('cn').get() } as AttributesMapper<String>)
}
I'm getting the error: Unable to resolve class AttributesMapper
Jira version 8.5.1
Script Runner version: 5.7.0.1-p5
Hi,
It appears that the example code is missing some imports. In full, I believe it should be:
import com.onresolve.scriptrunner.ldap.LdapUtil
import org.springframework.ldap.core.AttributesMapper
import javax.naming.directory.SearchControls
import javax.naming.directory.Attributes
def cnList = LdapUtil.withTemplate('corporate') { template ->
template.search("", "(sn=Smi*)", SearchControls.SUBTREE_SCOPE, { Attributes attributes ->
attributes.get('cn').get()
} as AttributesMapper<String>)
}
NB. Annotating the attributes parameter as being of type Attributes is only done to satisfy the static type checker: it can safely be left out without changing the way the code behaves at run time.
Kind regards,
Joanna Choules, Adaptavist Product Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello
But where can I download com.onresolve.scriptrunner.ldap.LdapUtil ? There no any jars on https://mvnrepository.com/maven
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
There is no need to download and import `LdapUtil` separately: it is part of the regular ScriptRunner installation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI @Joanna Choules ,
I used the same code any Idea why am I getting
org.springframework.ldap.PartialResultException: Unprocessed Continuation Reference(s); nested exception is javax.naming.PartialResultException: Unprocessed Continuation Reference(s); remaining name ''
Error.
Thanks
Ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How would I modify the script if I want to get the "company" attribute from a user?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello! @Joanna Choules
I was actually able to do this and the script returns a list of users that belong to the company I need.
However, there seem to be inactive and invalid users on the returned list.
Any idea how to get rid of them?
Thanks!
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.