@Override public void saveGroup(Group group) { getIdmIdentityService().saveGroup(group); }
@Override public void saveGroup(Group group) { getIdmIdentityService().saveGroup(group); }
protected Group createGroup(String id, String name, String type) { Group group = idmIdentityService.newGroup(id); group.setName(name); group.setType(type); idmIdentityService.saveGroup(group); return group; }
public Group createNewGroup(String id, String name, String type) { if (StringUtils.isBlank(name)) { throw new BadRequestException("Group name required"); } Group newGroup = identityService.newGroup(id); newGroup.setName(name); if (type == null) { newGroup.setType(GroupTypes.TYPE_ASSIGNMENT); } else { newGroup.setType(type); } identityService.saveGroup(newGroup); return newGroup; }
@ApiOperation(value = "Update a group", tags = { "Groups" }, notes = "All request values are optional. For example, you can only include the name attribute in the request body JSON-object, only updating the name of the group, leaving all other fields unaffected. When an attribute is explicitly included and is set to null, the group-value will be updated to null.") @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the group was updated."), @ApiResponse(code = 404, message = "Indicates the requested group was not found."), @ApiResponse(code = 409, message = "Indicates the requested group was updated simultaneously.") }) @PutMapping(value = "/groups/{groupId}", produces = "application/json") public GroupResponse updateGroup(@ApiParam(name = "groupId") @PathVariable String groupId, @RequestBody GroupRequest groupRequest, HttpServletRequest request) { Group group = getGroupFromRequest(groupId); if (groupRequest.getId() == null || groupRequest.getId().equals(group.getId())) { if (groupRequest.isNameChanged()) { group.setName(groupRequest.getName()); } if (groupRequest.isTypeChanged()) { group.setType(groupRequest.getType()); } identityService.saveGroup(group); } else { throw new FlowableIllegalArgumentException("Key provided in request body doesn't match the key in the resource URL."); } return restResponseFactory.createGroupResponse(group); }
public Group updateGroupName(String groupId, String name) { if (StringUtils.isBlank(name)) { throw new BadRequestException("Group name required"); } Group group = identityService.createGroupQuery().groupId(groupId).singleResult(); if (group == null) { throw new NotFoundException(); } group.setName(name); identityService.saveGroup(group); return group; }
@ApiOperation(value = "Create a group", tags = { "Groups" }) @ApiResponses(value = { @ApiResponse(code = 201, message = "Indicates the group was created."), @ApiResponse(code = 400, message = "Indicates the id of the group was missing.") }) @PostMapping(value = "/groups", produces = "application/json") public GroupResponse createGroup(@RequestBody GroupRequest groupRequest, HttpServletRequest httpRequest, HttpServletResponse response) { if (groupRequest.getId() == null) { throw new FlowableIllegalArgumentException("Id cannot be null."); } // Check if a user with the given ID already exists so we return a CONFLICT if (identityService.createGroupQuery().groupId(groupRequest.getId()).count() > 0) { throw new FlowableConflictException("A group with id '" + groupRequest.getId() + "' already exists."); } Group created = identityService.newGroup(groupRequest.getId()); created.setId(groupRequest.getId()); created.setName(groupRequest.getName()); created.setType(groupRequest.getType()); if (restApiInterceptor != null) { restApiInterceptor.createNewGroup(created); } identityService.saveGroup(created); response.setStatus(HttpStatus.CREATED.value()); return restResponseFactory.createGroupResponse(created); }