Is it possible to create a confluence group programmatically from a confluence plugin using java api? I went through confluence api reference but couldn't find the class used to create the group.
Any help/pointers will be appreciated.
Community moderators have prevented the ability to post new answers.
After looking at confluence source code, I managed to find the right way to do this:
import com.atlassian.spring.container.ContainerManager; import com.atlassian.user.EntityException; import com.atlassian.user.GroupManager; GroupManager groupManager = (GroupManager) ContainerManager.getInstance().getContainerContext().getComponent("groupManager"); groupManager.createGroup("group-name");
you can use createGroup(String groupName)
from UserManagementHelper, check following doc
https://docs.atlassian.com/atlassian-confluence/3.4.5/com/atlassian/confluence/it/usermanagement/DefaultUserManagementHelper.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That class belongs to test code which cannot be used. In the source code I see this class is located in: "confluence-project/confluence-test/confluence-test-support" directory.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
what do you mean by test code? if they used in test class does it mean we shouldn't use?
it is a public class "DefaultUserManagementHelper" so we can use this in our code!
any how you find working code! gald to hear that!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Test code is usually used for internal testing(junit, may be) purposes. Since their api reference doesn't explicitly state/explain anything about these classes or how they are supposed to be used, I prefer to stay away from them.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shravan,
It is possible to create a group via the api. See here :
https://developer.atlassian.com/display/CONFDEV/Remote+Confluence+Methods#RemoteConfluenceMethods-UserManagement
Look for function addGroup.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just an FYI there is already add-ons that make this possible:
https://bobswift.atlassian.net/wiki/display/ACLI/Atlassian+Command+Line+Interface
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I need to create groups from within a plugin. So I don't think using remote api is the best way to do it. Besides, there are a couple of other things we need to do in our plugin apart from creating groups, so I cant use CLI.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.