It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How activate Group via JIRA 7 Java API?

user45424 Aug 18, 2017

When trying to create new Group by writing

Group ng = groupMgr.createGroup("some_group");crowdService.addGroup(ng);

I get "Group already exists in the remote directory".

When using ProjectRoleService to add this Group to a ProjectRole I get "We ca't find 'some_group' in any accessible user directory. Check they're still active and available, and try again."

So I guess I just need to activate this group. How to do it via Java API

1 answer

0 votes
Nic Brough [Adaptavist] Community Leader Aug 18, 2017

A group might exist in a directory without necessarily being exposed to the applications.

One of my current projects involves a client with 10,000 users and 5,000 groups in their AD, but JIRA only sees 400 users and 50 groups because it is limited to one part of the directory.

Could that be the case?

user45424 Aug 18, 2017

That is what I think it is. One group (from problematic groups) was created (became available in JIRA application) after a user from that group logged in. Probably same would happen with all the groups (I am having trouble creating) if appropriate user would login, howerver I want these groups to be available in application before tha thappens.

Nic Brough [Adaptavist] Community Leader Aug 18, 2017

New groups that are exposed to the application should appear on the next synchronisation, as well as when a user logs in and hence uses the group.

user45424 Aug 18, 2017

How do I expose them to the applications using Java API?

Nic Brough [Adaptavist] Community Leader Aug 18, 2017

Trigger a synchronisation.

user45424 Aug 18, 2017

How? Like this?


DirectoryManager directoryManager = ComponentAccessor.getComponent(DirectoryManager.class);
for( Directory directory : directoryManager.findAllDirectories() ){
if( directoryManager.isSynchronisable( directory.getId() )
&& !directoryManager.isSynchronising( directory.getId() )){
directoryManager.synchroniseCache( directory.getId(), SynchronisationMode.INCREMENTAL );
} catch( Exception e ){
log.error("", e);
user45424 Aug 18, 2017

In the logs of the application I am working with I see even without the code I wrote above. So I guess synchronisation is happening (it is a scheduled repeating job).

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in United States

Topic Tuesday: Agile

Another week, another Topic Tuesday!  Agile has been on my mind a lot lately because I've seen good implementations and bad implementations, but now as a Jira admin it matters more to me whether...

31 views 0 0
View post

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you