Class GroupsController
- java.lang.Object
-
- org.craftercms.studio.controller.rest.v2.GroupsController
-
@RequestMapping("/api/2/groups") @RestController public class GroupsController extends Object
-
-
Constructor Summary
Constructors Constructor Description GroupsController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResponseBody
addGroupMembers(int groupId, AddGroupMembers addGroupMembers)
Add group members APIResponseBody
createGroup(Group group)
Create group APIResponseBody
deleteGroup(List<Long> groupIds)
Delete group APIResponseBody
getAllGroups(String keyword, int offset, int limit, String sort)
Get groups APIResponseBody
getGroup(int groupId)
Get group APIResponseBody
getGroupMembers(int groupId, int offset, int limit, String sort)
Get group members APIGroupService
getGroupService()
ResponseBody
removeGroupMembers(int groupId, List<Long> userIds, List<String> usernames)
Remove group members APIvoid
setGroupService(GroupService groupService)
ResponseBody
updateGroup(Group group)
Update group API
-
-
-
Method Detail
-
getAllGroups
@GetMapping public ResponseBody getAllGroups(@RequestParam(value="keyword",required=false) String keyword, @RequestParam(value="offset",required=false,defaultValue="0") int offset, @RequestParam(value="limit",required=false,defaultValue="10") int limit, @RequestParam(value="sort",required=false,defaultValue="") String sort) throws ServiceLayerException, OrganizationNotFoundException
Get groups API- Parameters:
keyword
- keyword parameteroffset
- offset parameterlimit
- limit parametersort
- sort parameter- Returns:
- Response containing list of groups
- Throws:
ServiceLayerException
OrganizationNotFoundException
-
createGroup
@ResponseStatus(CREATED) @PostMapping(consumes="application/json") public ResponseBody createGroup(@RequestBody Group group) throws GroupAlreadyExistsException, ServiceLayerException, AuthenticationException
Create group API- Parameters:
group
- Group to create- Returns:
- Response object
- Throws:
GroupAlreadyExistsException
ServiceLayerException
AuthenticationException
-
updateGroup
@PatchMapping(consumes="application/json") public ResponseBody updateGroup(@RequestBody Group group) throws ServiceLayerException, GroupNotFoundException, AuthenticationException
Update group API- Parameters:
group
- Group to update- Returns:
- Response object
- Throws:
ServiceLayerException
GroupNotFoundException
AuthenticationException
-
deleteGroup
@DeleteMapping public ResponseBody deleteGroup(@RequestParam("id") List<Long> groupIds) throws ServiceLayerException, GroupNotFoundException, AuthenticationException
Delete group API- Parameters:
groupIds
- Group identifier- Returns:
- Response object
- Throws:
ServiceLayerException
GroupNotFoundException
AuthenticationException
-
getGroup
@GetMapping("/{id}") public ResponseBody getGroup(@PathVariable("id") int groupId) throws ServiceLayerException, GroupNotFoundException
Get group API- Parameters:
groupId
- Group identifier- Returns:
- Response containing requested group
- Throws:
ServiceLayerException
GroupNotFoundException
-
getGroupMembers
@GetMapping("/{id}/members") public ResponseBody getGroupMembers(@PathVariable("id") int groupId, @RequestParam(value="offset",required=false,defaultValue="0") int offset, @RequestParam(value="limit",required=false,defaultValue="10") int limit, @RequestParam(value="sort",required=false,defaultValue="") String sort) throws ServiceLayerException, GroupNotFoundException
Get group members API- Parameters:
groupId
- Group identifieroffset
- Result set offsetlimit
- Result set limitsort
- Sort order- Returns:
- Response containing list od users
- Throws:
ServiceLayerException
GroupNotFoundException
-
addGroupMembers
@PostMapping(value="/{id}/members", consumes="application/json") public ResponseBody addGroupMembers(@PathVariable("id") int groupId, @RequestBody AddGroupMembers addGroupMembers) throws ServiceLayerException, UserNotFoundException, GroupNotFoundException, AuthenticationException
Add group members API- Parameters:
groupId
- Group identifiersaddGroupMembers
- Add members request body (json representation)- Returns:
- Response object
- Throws:
ServiceLayerException
UserNotFoundException
GroupNotFoundException
AuthenticationException
-
removeGroupMembers
@DeleteMapping("/{id}/members") public ResponseBody removeGroupMembers(@PathVariable("id") int groupId, @RequestParam(value="userId",required=false) List<Long> userIds, @RequestParam(value="username",required=false) List<String> usernames) throws ServiceLayerException, UserNotFoundException, GroupNotFoundException, AuthenticationException
Remove group members API- Parameters:
groupId
- Group identifieruserIds
- List of user identifiersusernames
- List of usernames- Returns:
- Response object
- Throws:
ServiceLayerException
UserNotFoundException
GroupNotFoundException
AuthenticationException
-
getGroupService
public GroupService getGroupService()
-
setGroupService
public void setGroupService(GroupService groupService)
-
-