How can I access the data of the User Profile Plugin
Good news for all developers: Starting with release 1.8, there is a REST API, which will provide access to the data of the User Profile Plugin.
This information is only relevant for User Profile Plugin releases < 1.10. Starting with release 1.10, the data is not stored in Bandana anymore.
This information is intended for developers and should help to access the data stored by the User Profile Plugin (UPP) as long as there is no public API. The information and procedures describes here are not supported, especially if you plan to manipulate the data stored by the UPP.
You have been warned .
Standard Profile Elements
The data for the standard profile elements (like IM, departments, position, ...) is stored like in Confluence standard. You can access them using the UserDetailsManager of the Confluence API.
Custom Profile Elements
Please note that the data structures described here might change in future releases.
The data for the custom profile elements is stored in the Bandana storage for Confluence, which is basically a key-value-store. This store holds its data in the BANDANA table of the Confluence database.
So to look up the data for a specific profile element the BandanaManager from the Confluence API can be used (use autowiring like with any other manager to get it injected in your Action, Component or whatever Plugin Module you use). The manager provides methods to read the data from the store. Therefore you need the keys for the stored data.
Keys for all Custom Profile Elements
Each custom profile element has a unique key. The keys for all custom profile element can be found in a Bandana entry which is a serialized Collection and has the following Bandana key: de.communardo.userprofile.profile.elem.keys
Information about a specific Profile Element
The information for a profile element (like its name, translations, the type, ...) can be found in a Bandana entry which is a serialized Map and has the following Bandana key:de.communardo.userprofile.profile.elem.key.<element key>
Where "<element key>"
is a key of any profile element.
Data for a specific Profile Element and User
The data for a specific element of a specific user can be found in a Bandana entry which has the following Bandana key:
de.communardo.userprofile.element.data.<element key>.<username>
Where
"<element key>"
is the key of the profile element and"<username>"
is the login of the user
Note
Starting with User Profile Plugin 1.9 and Confluence 5.3 the data is stored using the user key for the <username> placeholder.Â
Example
You have a custom field, say "Favorite Color" with the key "12345". To get the favorite color of the with the login "twi" you would have to make the following call:
... public Object getFavColorForTwi(){ ConfluenceBandanaContext ctx = new ConfluenceBandanaContext(null); // GLOBAL context String bandanaKey = "de.communardo.userprofile.element.data.12345.twi"; return this.bandanaManager.getValue(ctx, bandanaKey); } ...
The Bandana Editor Plugin from Atlassian Labs might be helpful in exploring the Bandana data structures.