string mgr = ldapUserAttr("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 = ldapUserAttr("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);
} |