I'm banging my head against this. I'm pretty sure it's simple but my MySQL is pretty rusty. What I'd like to do is return usernames, full name email address and group memeberships for users who are both in "jira-login" and in another one of a list of groups. Example:
davebloggs is in jira-login and client1 and his details should be in the results
fredbloggs is in client1 but not in jira-login his details should be excluded
joebloggs is in client2 and jira-login and his details should be returned
billbloggs is in jira-login only and his details should be excluded
Can anyone help?
Hi Graham, you can retrieve the list of members of a group with the following query:
select * from cwd_membership where parent_name = '<group_name>';
Then, you can run another query like this to return the user informtion:
select * from cwd_user where lower_user_name in (select child_name from cwd_membership where parent_name = '<group_name>')
I hope it helps.
If you have "Nested Groups" enabled, this isn't going to be easy. However, if you do not mind getting only the direct members and that you will also get answers for disabled directories, I think you want something like this:
SELECT cu.user_name, cu.display_name, cu.email_address FROM cwd_user AS cu INNER JOIN cwd_membership AS cm ON cu.directory_id=cm.directory_id AND cu.lower_user_name=cm.lower_child_name AND cm.membership_type='GROUP_USER' WHERE cm.lower_parent_name='jira-login';
Sorry, that gets all of those in jira-login... rereading your requirements, add to this something like:
AND EXISTS ( SELECT 1 FROM cwd_membership x WHERE x.directory_id=cu.directory_id AND x.lower_child_name=cu.lower_user_name AND x.lower_parent_name <> 'jira-login' )
It's a bit gross, but should get you there.
I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs