Skip to end of banner
Go to start of banner

LDAP searches

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

The following solution was kindly provided by Stefano Gevinti (thanks!)


Required apps

Power Scripts™ for Jira (server)

Level: BASIC

Problem

At creation time, you want to assign the issue first to the manager of the current user, to decide and categorize the issue. The problem is that the relationship between the current user and the manager is not declared in Jira (as a project admin, for instance), but in the LDAP.

Solution


create_postfunction.sil
string mgr = ldapUserRecord("manager", "(sAMAccountName=" + currentUser() + ")"); //get the current user's manager DN

string cnUser = substring(mgr, 0, indexOf(mgr,",")); //establish the cn, this is the manager user (that may depend on your setup)

string mgrUserName = ldapUserRecord("sAMAccountName", cnUser); //again, a lookup in the Active Directory to get the manager

//Note: these LDAP calls are automatically cached, so performance gets better if it is found in cache

if(userExists(mgrUserName)) { //make sure this is defined in JIRA
 assignee = mgrUserName;
} else {
 //fallback to project admin
 assignee = projectPM(project);
}

This postfunction should be the last in the call chain at create.

All you have to do now is to configure your LDAP and there you go !

The above assumes that the windows account name is the same the user is using to access Jira. This is really dependent on the AD setup.

See also

  • No labels