Script Runner -- checking if user is in crowd directory that uses ldap.

Bryan Karsh
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 9, 2014

Hi,

Our Jira instance is integrated with an external crowd. The crowd instance has several directories -- one of them uses the Microsoft Active Directory connector.

Just to be clear -- our Jira connects to crowd via a single user directory.

Is there away in script runner to check if a username is one that uses the ldap connector in crowd from with Jira -- wasn't sure if the embedded crowd api could do that?

Tips appreciated.

2 answers

1 accepted

0 votes
Answer accepted
Caspar Krieger
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 12, 2014

It sounds like you're trying to determine which directory in Crowd a user came from, from the perspective of an application connected to Crowd. If so, that will be difficult to impossible, as Crowd has "abstract away directory aggregation from applications" as one of its design goals.

Certainly if you were to work out a way of doing this, it's extremely likely that we won't ensure backwards compatibility with it (in fact, it's more likely to be treated as a bug).

Bryan Karsh
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 12, 2014

yep - exactly. Thanks for the info/insight!

0 votes
Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 11, 2014

I think you can use these methods from package com.atlassian.crowd.embedded.api:

  • User.getDirectoryId()
  • CrowdDirectoryService.findDirectoryById()
  • Directory.getType()

to get an enum DirectoryType for a user. I don't know if this is enough to distinguish the directories. Maybe even the directory id is enough if it's a local script.

Bryan Karsh
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 11, 2014

Thanks Henning -- I'll look into those.

I do know that

  • User.getDirectoryId() will only give the directory id of the crowd connection in Jira. For example, I get a directory id of '2' -- which corresponds to crowd. But if I look at crowd, I see several ids for the individual directories.
Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 11, 2014

Ah... multiple directories in Crowd. Ok. I can't say anything for this situation, I think the data is only for the JIRA directories. Next time I try to read with more attention. Sorry.

Suggest an answer

Log in or Sign up to answer