Getting User Groups

Hi,
I’m trying to rewrite one of our plugins to work with bitbucket too, Currently, it’s working with JIRA and Confluence but the “core code” has been duplicated. Therefore I wanted to extract the code in a separate maven project. I migrated our Admin Config Page to a Servlet using SAL functions to retrieve for example users. Now I have the problem, that we have a group picker on this page and I need to get all groups from the system. Unfortunately, SAL has no groupmanager. In our JIRA plugin, we are using the Class GroupManager from com.atlassian.jira.security.groups and in our Confluence plugin GroupManager from com.atlassian.user.

When I try to use the GroupManager from com.atlassian.user in Bitbucket the build fails with the error

error: package com.atlassian.user does not exist.

When I add com.atlassian.user as a maven dependency without scope in the pom I’m getting the following Osgi error during startup:

[INFO] [talledLocalContainer] 2017-07-07 13:54:35,491 ERROR [spring-startup]  c.a.plugin.osgi.factory.OsgiPlugin Detected an error (BundleException) enabling the plugin 'de.example' : Unresolved constraint in bundle de.example [127]: Unable to resolve 127.0: missing requirement [127.0] osgi.wiring.package; (osgi.wiring.package=bsh). 

When I add the dependency with the scope provided, I’m getting the osgi error:

[INFO] [talledLocalContainer] 2017-07-07 13:40:24,707 ERROR [spring-startup]  c.a.plugin.osgi.factory.OsgiPlugin Detected an error (BundleException) enabling the plugin 'de.example' : Unresolved constraint in bundle de.example [127]: Unable to resolve 127.0: missing requirement [127.0] osgi.wiring.package; (osgi.wiring.package=com.atlassian.user)

Does anybody know how to solve the errors or how to get Groups in one Class for all three Applications (JIRA, Confluence, Bitbucket?

Thank you very much!
Matthias

Dear Matthias,

sadly SAL does not provide a Group manager. So you need a special implementation for every product. For example, if you want to retrieve all groups a user is in, in Confluence, you have to use com.atlassian.confluence.user.UserAccessor, while in Bitbucket you need com.atlassian.bitbucket.user.UserService.

1 Like