Class GroupsController
java.lang.Object
com.atlassian.crowd.plugin.rest.service.controller.AbstractResourceController
com.atlassian.crowd.plugin.rest.service.controller.GroupsController
Controller for the Group resource.
-
Constructor Summary
ConstructorDescriptionGroupsController
(ApplicationService applicationService, AuthenticatedApplicationHolder authenticatedApplicationHolder) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDirectChildGroup
(String groupName, String childGroupName) Adds a direct child group membership.void
addDirectParentGroup
(String groupName, String parentGroupName) Adds a direct parent group membership.void
addDirectUser
(String groupName, String username) Adds user as direct member of group.addGroup
(GroupEntity group, com.atlassian.plugins.rest.api.model.Link groupLink) Adds a new group.void
deleteDirectChildGroup
(String groupName, String childGroupName) Deletes a child group membership.void
deleteDirectUser
(String groupName, String username) Removes the user membership.findGroupByName
(String name, boolean expandAttributes, URI baseURI) Returns the group specified by the name.getDirectChildGroup
(String groupName, String childGroupName, URI baseUri) Retrieves the group that is a direct child of the specified group.getDirectChildGroups
(String groupName, boolean expandGroups, int maxResults, int startIndex, URI baseUri) Retrieves the groups that are direct members of the specified group.getDirectParentGroup
(String groupName, String parentGroupName, URI baseUri) Retrieves the group that is a direct parent of the specified group.getDirectParentGroups
(String groupName, boolean expandGroups, int maxResults, int startIndex, URI baseUri) Retrieves the groups that are direct parents of the specified group.getDirectUser
(String groupName, String username, URI baseUri) Retrieves the user that is a direct member of the specified group.getDirectUsers
(String groupName, boolean expandUsers, int maxResults, int startIndex, URI baseUri) Retrieves the users that are direct members of the specified group.getNestedChildGroup
(String groupName, String childGroupName, URI baseUri) Retrieves the group that is a nested child of the specified group.getNestedChildGroups
(String groupName, boolean expandGroups, int maxResults, int startIndex, URI baseUri) Retrieves the groups that are nested children of the specified group.getNestedParentGroup
(String groupName, String parentGroupName, URI baseUri) Retrieves the group that is a nested parent of the specified group.getNestedParentGroups
(String groupName, boolean expandGroups, int maxResults, int startIndex, URI baseUri) Retrieves the groups that are nested parents of the specified group.getNestedUser
(String groupName, String username, URI baseUri) Retrieves the user that is a nested member of the specified group.getNestedUsers
(String groupName, boolean expandUsers, int maxResults, int startIndex, URI baseUri) Retrieves the users that are nested members of the specified group.void
removeGroup
(String groupName) Removes a group.void
removeGroupAttributes
(String groupName, String attributeName) Removes a group's attribute.void
storeGroupAttributes
(String groupName, MultiValuedAttributeEntityList attributes) Stores the attributes for a group.updateGroup
(GroupEntity group, URI baseURI) Updates a group.Methods inherited from class com.atlassian.crowd.plugin.rest.service.controller.AbstractResourceController
getAuthenticatedApplication
-
Constructor Details
-
GroupsController
@Inject public GroupsController(ApplicationService applicationService, AuthenticatedApplicationHolder authenticatedApplicationHolder)
-
-
Method Details
-
findGroupByName
public GroupEntity findGroupByName(String name, boolean expandAttributes, URI baseURI) throws GroupNotFoundException Returns the group specified by the name.- Parameters:
name
- name of the group to returnexpandAttributes
- should attributes be expandedbaseURI
- base URI- Returns:
- group
- Throws:
GroupNotFoundException
-
addGroup
public GroupEntity addGroup(GroupEntity group, com.atlassian.plugins.rest.api.model.Link groupLink) throws ApplicationPermissionException, OperationFailedException, InvalidGroupException, GroupNotFoundException Adds a new group.- Parameters:
group
- group to add- Returns:
- group name just added
- Throws:
ApplicationPermissionException
- if none of the application's underlying directories are allowed to create a groupOperationFailedException
- if the operation failed for any other reasonInvalidGroupException
GroupNotFoundException
-
updateGroup
public GroupEntity updateGroup(GroupEntity group, URI baseURI) throws ApplicationPermissionException, OperationFailedException, InvalidGroupException, GroupNotFoundException Updates a group.- Parameters:
group
- group to updatebaseURI
- base URI- Returns:
- group
- Throws:
InvalidGroupException
- if the group already exists in ANY associated directory or the group template does not have the required properties populated.OperationFailedException
- underlying directory implementation failed to execute the operation.ApplicationPermissionException
- if none of the application's associated directories are allowed to perform operations of typeOperationType.UPDATE_GROUP
.GroupNotFoundException
- group does not exist in any of the associated directories of the application.
-
removeGroup
public void removeGroup(String groupName) throws ApplicationPermissionException, OperationFailedException, GroupNotFoundException Removes a group.- Parameters:
groupName
- name of the group- Throws:
OperationFailedException
- underlying directory implementation failed to execute the operation.GroupNotFoundException
- if group with given name does not exist in ANY assigned directory.ApplicationPermissionException
- if none of the application's associated directories are allowed to perform operations of typeOperationType.DELETE_GROUP
.
-
storeGroupAttributes
public void storeGroupAttributes(String groupName, MultiValuedAttributeEntityList attributes) throws ApplicationPermissionException, OperationFailedException, GroupNotFoundException Stores the attributes for a group.- Parameters:
groupName
- name of the groupattributes
- attributes to add/update- Throws:
GroupNotFoundException
- if the group with the supplied groupname does not exist in ANY assigned directory.OperationFailedException
- underlying directory implementation failed to execute the operation.ApplicationPermissionException
- if none of the application's associated directories are allowed to perform operations of typeOperationType.UPDATE_GROUP_ATTRIBUTE
.
-
removeGroupAttributes
public void removeGroupAttributes(String groupName, String attributeName) throws ApplicationPermissionException, OperationFailedException, GroupNotFoundException Removes a group's attribute.- Parameters:
groupName
- name of the groupattributeName
- attribute to remove- Throws:
GroupNotFoundException
- if the group with the supplied groupname does not exist in ANY assigned directory.OperationFailedException
- underlying directory implementation failed to execute the operation.ApplicationPermissionException
- if none of the application's associated directories are allowed to perform operations of typeOperationType.UPDATE_GROUP_ATTRIBUTE
.
-
getDirectUsers
public UserEntityList getDirectUsers(String groupName, boolean expandUsers, int maxResults, int startIndex, URI baseUri) throws GroupNotFoundException Retrieves the users that are direct members of the specified group.- Parameters:
groupName
- name of the groupexpandUsers
- should users be expandedmaxResults
- maximum number of results returned. If -1, then all the results are returned.startIndex
- starting index of the resultsbaseUri
- base URI- Returns:
- users that are direct members of the specified group
- Throws:
GroupNotFoundException
-
addDirectUser
public void addDirectUser(String groupName, String username) throws ApplicationPermissionException, UserNotFoundException, GroupNotFoundException, OperationFailedException, MembershipAlreadyExistsException Adds user as direct member of group.- Parameters:
groupName
- name of the groupusername
- name of the child group- Throws:
ApplicationPermissionException
- if none of the application's associated directories are allowed to perform operations of typeOperationType.UPDATE_GROUP
.MembershipAlreadyExistsException
- if the user is already a member of the groupUserNotFoundException
GroupNotFoundException
OperationFailedException
-
getDirectUser
public UserEntity getDirectUser(String groupName, String username, URI baseUri) throws MembershipNotFoundException, GroupNotFoundException Retrieves the user that is a direct member of the specified group.- Parameters:
groupName
- name of the groupusername
- name of the child groupbaseUri
- base URI- Returns:
- user that is a direct member of the specified group
- Throws:
MembershipNotFoundException
GroupNotFoundException
-
deleteDirectUser
public void deleteDirectUser(String groupName, String username) throws ApplicationPermissionException, MembershipNotFoundException, UserNotFoundException, GroupNotFoundException, OperationFailedException Removes the user membership.- Parameters:
groupName
- name of the groupusername
- name of the user- Throws:
ApplicationPermissionException
- if none of the application's associated directories are allowed to perform operations of typeOperationType.UPDATE_GROUP
.MembershipNotFoundException
UserNotFoundException
GroupNotFoundException
OperationFailedException
-
getNestedUsers
public UserEntityList getNestedUsers(String groupName, boolean expandUsers, int maxResults, int startIndex, URI baseUri) throws GroupNotFoundException Retrieves the users that are nested members of the specified group.- Parameters:
groupName
- name of the groupexpandUsers
- should groups be expandedmaxResults
- maximum number of results returned. If -1, then all the results are returned.startIndex
- starting index of the resultsbaseUri
- base URI- Returns:
- users that are nested members of the specified group
- Throws:
GroupNotFoundException
-
getNestedUser
public UserEntity getNestedUser(String groupName, String username, URI baseUri) throws MembershipNotFoundException, GroupNotFoundException Retrieves the user that is a nested member of the specified group.- Parameters:
groupName
- name of the groupusername
- name of the userbaseUri
- base URI- Returns:
- user that is a nested member of the specified group
- Throws:
MembershipNotFoundException
GroupNotFoundException
-
getDirectParentGroups
public GroupEntityList getDirectParentGroups(String groupName, boolean expandGroups, int maxResults, int startIndex, URI baseUri) Retrieves the groups that are direct parents of the specified group.- Parameters:
groupName
- name of the groupexpandGroups
- should groups be expandedmaxResults
- maximum number of results returned. If -1, then all the results are returned.startIndex
- starting index of the resultsbaseUri
- base URI- Returns:
- groups that are direct parents of the specified group
-
addDirectParentGroup
public void addDirectParentGroup(String groupName, String parentGroupName) throws ApplicationPermissionException, InvalidMembershipException, GroupNotFoundException, OperationFailedException, MembershipAlreadyExistsException Adds a direct parent group membership.- Parameters:
groupName
- name of the groupparentGroupName
- name of the parent group- Throws:
ApplicationPermissionException
- if none of the application's associated directories are allowed to perform operations of typeOperationType.UPDATE_GROUP
.MembershipAlreadyExistsException
- if the child group is already a child of the parent groupInvalidMembershipException
GroupNotFoundException
OperationFailedException
-
getDirectParentGroup
public GroupEntity getDirectParentGroup(String groupName, String parentGroupName, URI baseUri) throws MembershipNotFoundException Retrieves the group that is a direct parent of the specified group.- Parameters:
groupName
- name of the groupparentGroupName
- name of the parent groupbaseUri
- base URI- Returns:
- group that is a direct parent of the specified group
- Throws:
MembershipNotFoundException
-
getNestedParentGroups
public GroupEntityList getNestedParentGroups(String groupName, boolean expandGroups, int maxResults, int startIndex, URI baseUri) Retrieves the groups that are nested parents of the specified group.- Parameters:
groupName
- name of the groupexpandGroups
- should groups be expandedmaxResults
- maximum number of results returned. If -1, then all the results are returned.startIndex
- starting index of the resultsbaseUri
- base URI- Returns:
- groups that are nested parents of the specified group
-
getNestedParentGroup
public GroupEntity getNestedParentGroup(String groupName, String parentGroupName, URI baseUri) throws MembershipNotFoundException Retrieves the group that is a nested parent of the specified group.- Parameters:
groupName
- name of the groupparentGroupName
- name of the parent groupbaseUri
- base URI- Returns:
- group that is a nested parent of the specified group
- Throws:
MembershipNotFoundException
-
getDirectChildGroups
public GroupEntityList getDirectChildGroups(String groupName, boolean expandGroups, int maxResults, int startIndex, URI baseUri) Retrieves the groups that are direct members of the specified group.- Parameters:
groupName
- name of the groupexpandGroups
- should groups be expandedmaxResults
- maximum number of results returned. If -1, then all the results are returned.startIndex
- starting index of the resultsbaseUri
- base URI- Returns:
- groups that are direct members of the specified group
-
addDirectChildGroup
public void addDirectChildGroup(String groupName, String childGroupName) throws ApplicationPermissionException, InvalidMembershipException, GroupNotFoundException, OperationFailedException, MembershipAlreadyExistsException Adds a direct child group membership.- Parameters:
groupName
- name of the groupchildGroupName
- name of the child group- Throws:
MembershipAlreadyExistsException
- if the child group is already a child of the parent groupApplicationPermissionException
- if none of the application's associated directories are allowed to perform operations of typeOperationType.UPDATE_GROUP
.InvalidMembershipException
GroupNotFoundException
OperationFailedException
-
getDirectChildGroup
public GroupEntity getDirectChildGroup(String groupName, String childGroupName, URI baseUri) throws MembershipNotFoundException Retrieves the group that is a direct child of the specified group.- Parameters:
groupName
- name of the groupchildGroupName
- name of the child groupbaseUri
- base URI- Returns:
- group that is a direct child of the specified group
- Throws:
MembershipNotFoundException
-
deleteDirectChildGroup
public void deleteDirectChildGroup(String groupName, String childGroupName) throws ApplicationPermissionException, MembershipNotFoundException, GroupNotFoundException, OperationFailedException Deletes a child group membership.- Parameters:
groupName
- name of the groupchildGroupName
- name of the child group- Throws:
ApplicationPermissionException
- if none of the application's associated directories are allowed to perform operations of typeOperationType.UPDATE_GROUP
.MembershipNotFoundException
GroupNotFoundException
OperationFailedException
-
getNestedChildGroups
public GroupEntityList getNestedChildGroups(String groupName, boolean expandGroups, int maxResults, int startIndex, URI baseUri) Retrieves the groups that are nested children of the specified group.- Parameters:
groupName
- name of the groupexpandGroups
- should groups be expandedmaxResults
- maximum number of results returned. If -1, then all the results are returned.startIndex
- starting index of the resultsbaseUri
- base URI- Returns:
- groups that are nested children of the specified group
-
getNestedChildGroup
public GroupEntity getNestedChildGroup(String groupName, String childGroupName, URI baseUri) throws MembershipNotFoundException Retrieves the group that is a nested child of the specified group.- Parameters:
groupName
- name of the groupchildGroupName
- name of the child groupbaseUri
- base URI- Returns:
- group that is a nested child of the specified group
- Throws:
MembershipNotFoundException
-