Skip to content

Commit

Permalink
Restdocs for /Groups/xxx/members
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Coffield authored and pivotal committed Jun 4, 2016
1 parent bbe5c1c commit 5102428
Show file tree
Hide file tree
Showing 7 changed files with 220 additions and 175 deletions.
Expand Up @@ -12,16 +12,14 @@
*******************************************************************************/ *******************************************************************************/
package org.cloudfoundry.identity.uaa.scim; package org.cloudfoundry.identity.uaa.scim;


import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.cloudfoundry.identity.uaa.scim.impl.ScimGroupJsonDeserializer;
import org.cloudfoundry.identity.uaa.scim.impl.ScimGroupJsonSerializer;


import java.util.List; import java.util.List;




@JsonSerialize(using = ScimGroupJsonSerializer.class, include = JsonSerialize.Inclusion.NON_NULL) @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@JsonDeserialize(using = ScimGroupJsonDeserializer.class) @JsonIgnoreProperties(ignoreUnknown = true)
public class ScimGroup extends ScimCore { public class ScimGroup extends ScimCore {


private String displayName; private String displayName;
Expand Down
Expand Up @@ -33,7 +33,7 @@ public void setEntity(TEntity entity) {


@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public enum Role { public enum Role {
MEMBER, READER, WRITER; MEMBER, READER, WRITER
} }


public static final List<Role> GROUP_MEMBER = Arrays.asList(Role.MEMBER); public static final List<Role> GROUP_MEMBER = Arrays.asList(Role.MEMBER);
Expand Down

This file was deleted.

This file was deleted.

Expand Up @@ -417,6 +417,7 @@ public ScimGroup deleteGroup(@PathVariable String groupId,
@RequestMapping(value = { "/Groups/zones" }, method = RequestMethod.POST) @RequestMapping(value = { "/Groups/zones" }, method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED) @ResponseStatus(HttpStatus.CREATED)
@ResponseBody @ResponseBody
@Deprecated
public ScimGroup addZoneManagers(@RequestBody ScimGroup group, HttpServletResponse httpServletResponse) { public ScimGroup addZoneManagers(@RequestBody ScimGroup group, HttpServletResponse httpServletResponse) {
if (!group.getDisplayName().matches(ZONE_MANAGING_SCOPE_REGEX)) { if (!group.getDisplayName().matches(ZONE_MANAGING_SCOPE_REGEX)) {
throw new ScimException("Invalid group name.", HttpStatus.BAD_REQUEST); throw new ScimException("Invalid group name.", HttpStatus.BAD_REQUEST);
Expand Down Expand Up @@ -447,13 +448,15 @@ public ScimGroup addZoneManagers(@RequestBody ScimGroup group, HttpServletRespon
@RequestMapping(value = { "/Groups/zones/{userId}/{zoneId}" }, method = RequestMethod.DELETE) @RequestMapping(value = { "/Groups/zones/{userId}/{zoneId}" }, method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ResponseBody @ResponseBody
@Deprecated
public ScimGroup deleteZoneAdmin(@PathVariable String userId, @PathVariable String zoneId, HttpServletResponse httpServletResponse) { public ScimGroup deleteZoneAdmin(@PathVariable String userId, @PathVariable String zoneId, HttpServletResponse httpServletResponse) {
return deleteZoneScope(userId, zoneId, "admin", httpServletResponse); return deleteZoneScope(userId, zoneId, "admin", httpServletResponse);
} }


@RequestMapping(value = { "/Groups/zones/{userId}/{zoneId}/{scope}" }, method = RequestMethod.DELETE) @RequestMapping(value = { "/Groups/zones/{userId}/{zoneId}/{scope}" }, method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ResponseBody @ResponseBody
@Deprecated
public ScimGroup deleteZoneScope(@PathVariable String userId, public ScimGroup deleteZoneScope(@PathVariable String userId,
@PathVariable String zoneId, @PathVariable String zoneId,
@PathVariable String scope, @PathVariable String scope,
Expand Down Expand Up @@ -498,6 +501,7 @@ public ResponseEntity<List<ScimGroupMember>> listGroupMemberships(@PathVariable


@RequestMapping(value = "/Groups/{groupId}/members", method = RequestMethod.PUT) @RequestMapping(value = "/Groups/{groupId}/members", method = RequestMethod.PUT)
@ResponseBody @ResponseBody
@Deprecated
public ScimGroupMember editMemberInGroup(@PathVariable String groupId, @RequestBody ScimGroupMember member) { public ScimGroupMember editMemberInGroup(@PathVariable String groupId, @RequestBody ScimGroupMember member) {
return membershipManager.updateMember(groupId, member); return membershipManager.updateMember(groupId, member);
} }
Expand Down
105 changes: 105 additions & 0 deletions uaa/slate/source/index.md.erb
Expand Up @@ -1248,6 +1248,111 @@ _Response Fields_
| 400 | Bad Request - Invalid attributes | | 400 | Bad Request - Invalid attributes |
| 403 | Forbidden - Insufficient scope | | 403 | Forbidden - Insufficient scope |


## Check Membership

<%= ERB.new(File.read("../build/generated-snippets/ScimGroupEndpointsDocs/getMemberOfGroup/curl-request.md")).result(binding) %>
<%= ERB.new(File.read("../build/generated-snippets/ScimGroupEndpointsDocs/getMemberOfGroup/http-request.md")).result(binding) %>
<%= ERB.new(File.read("../build/generated-snippets/ScimGroupEndpointsDocs/getMemberOfGroup/http-response.md")).result(binding) %>

_Path Parameters_

<%= ERB.new(File.read("../build/generated-snippets/ScimGroupEndpointsDocs/getMemberOfGroup/path-parameters.md")).result(binding) %>

_Request Headers_

<%= ERB.new(File.read("../build/generated-snippets/ScimGroupEndpointsDocs/getMemberOfGroup/request-headers.md")).result(binding) %>

_Response Fields_

<%= ERB.new(File.read("../build/generated-snippets/ScimGroupEndpointsDocs/getMemberOfGroup/response-fields.md")).result(binding) %>

| Error Code | Description |
|------------|-----------------------------------------------------------------------|
| 400 | Bad Request - Invalid member ID |
| 403 | Forbidden - Insufficient scope |
| 404 | Not Found - Group does not exist, or the entity is not a member |

## Add Member

<%= ERB.new(File.read("../build/generated-snippets/ScimGroupEndpointsDocs/addMemberToGroup/curl-request.md")).result(binding) %>
<%= ERB.new(File.read("../build/generated-snippets/ScimGroupEndpointsDocs/addMemberToGroup/http-request.md")).result(binding) %>
<%= ERB.new(File.read("../build/generated-snippets/ScimGroupEndpointsDocs/addMemberToGroup/http-response.md")).result(binding) %>

_Path Parameters_

<%= ERB.new(File.read("../build/generated-snippets/ScimGroupEndpointsDocs/addMemberToGroup/path-parameters.md")).result(binding) %>

_Request Headers_

<%= ERB.new(File.read("../build/generated-snippets/ScimGroupEndpointsDocs/addMemberToGroup/request-headers.md")).result(binding) %>

_Request Fields_

<%= ERB.new(File.read("../build/generated-snippets/ScimGroupEndpointsDocs/addMemberToGroup/request-fields.md")).result(binding) %>

_Response Fields_

<%= ERB.new(File.read("../build/generated-snippets/ScimGroupEndpointsDocs/addMemberToGroup/response-fields.md")).result(binding) %>

| Error Code | Description |
|------------|-----------------------------------------------------------------------|
| 400 | Bad Request - Invalid member ID |
| 403 | Forbidden - Insufficient scope |
| 404 | Not Found - Specified group or member entity does not exist |

## Remove Member

<%= ERB.new(File.read("../build/generated-snippets/ScimGroupEndpointsDocs/removeMemberFromGroup/curl-request.md")).result(binding) %>
<%= ERB.new(File.read("../build/generated-snippets/ScimGroupEndpointsDocs/removeMemberFromGroup/http-request.md")).result(binding) %>
<%= ERB.new(File.read("../build/generated-snippets/ScimGroupEndpointsDocs/removeMemberFromGroup/http-response.md")).result(binding) %>

_Path Parameters_

<%= ERB.new(File.read("../build/generated-snippets/ScimGroupEndpointsDocs/removeMemberFromGroup/path-parameters.md")).result(binding) %>

_Request Headers_

<%= ERB.new(File.read("../build/generated-snippets/ScimGroupEndpointsDocs/removeMemberFromGroup/request-headers.md")).result(binding) %>

_Response Fields_

<%= ERB.new(File.read("../build/generated-snippets/ScimGroupEndpointsDocs/removeMemberFromGroup/response-fields.md")).result(binding) %>

| Error Code | Description |
|------------|-----------------------------------------------------------------------|
| 400 | Bad Request - Incorrect version supplied in If-Match header |
| 403 | Forbidden - Insufficient scope |
| 404 | Not Found - Group does not exist, or the entity is not a member |
| 409 | Conflict |

## List Members

<%= ERB.new(File.read("../build/generated-snippets/ScimGroupEndpointsDocs/listMembersOfGroup/curl-request.md")).result(binding) %>
<%= ERB.new(File.read("../build/generated-snippets/ScimGroupEndpointsDocs/listMembersOfGroup/http-request.md")).result(binding) %>
<%= ERB.new(File.read("../build/generated-snippets/ScimGroupEndpointsDocs/listMembersOfGroup/http-response.md")).result(binding) %>

_Path Parameters_

<%= ERB.new(File.read("../build/generated-snippets/ScimGroupEndpointsDocs/listMembersOfGroup/path-parameters.md")).result(binding) %>

_Request Headers_

<%= ERB.new(File.read("../build/generated-snippets/ScimGroupEndpointsDocs/listMembersOfGroup/request-headers.md")).result(binding) %>

_Request Parameters_

<%= ERB.new(File.read("../build/generated-snippets/ScimGroupEndpointsDocs/listMembersOfGroup/request-parameters.md")).result(binding) %>

_Response Fields_

<%= ERB.new(File.read("../build/generated-snippets/ScimGroupEndpointsDocs/listMembersOfGroup/response-fields.md")).result(binding) %>

| Error Code | Description |
|------------|-----------------------------------------------------------------------|
| 400 | Bad Request - Invalid attributes |
| 403 | Forbidden - Insufficient scope |
| 404 | Not Found - Specified group does not exist |

## External Group Mappings ## External Group Mappings


### Map ### Map
Expand Down

0 comments on commit 5102428

Please sign in to comment.