Commit dacc07d1 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

documentation for granting/revoking project privileges

parent ff34db52
= Rest API Documentation - Project privileges
Piotr Gawron
v{project-version} {build-time}
:toc: left
:sectnums:
== Grant privilege
Grant access to the project.
=== Path Parameters
include::{snippets}/projects/project_privileges/grant_privilege/path-parameters.adoc[]
=== Request Fields
include::{snippets}/projects/project_privileges/grant_privilege/request-fields.adoc[]
=== CURL sample
include::{snippets}/projects/project_privileges/grant_privilege/curl-request.adoc[]
== Revoke privilege
Revoke access to the project.
=== Path Parameters
include::{snippets}/projects/project_privileges/revoke_privilege/path-parameters.adoc[]
=== Request Fields
include::{snippets}/projects/project_privileges/revoke_privilege/request-fields.adoc[]
=== CURL sample
include::{snippets}/projects/project_privileges/revoke_privilege/curl-request.adoc[]
......@@ -213,11 +213,23 @@ public class ProjectControllerIntegrationTest extends ControllerIntegrationTest
+ "\"login\":\"" + CURATOR_LOGIN + "\""
+ "}]";
RequestBuilder request = patch("/projects/" + TEST_PROJECT + ":grantPrivileges")
RequestBuilder request = patch("/projects/{projectId}:grantPrivileges", TEST_PROJECT)
.content(body)
.session(session);
mockMvc.perform(request)
.andDo(document("projects/project_privileges/grant_privilege",
pathParameters(parameterWithName("projectId").description("project identifier")),
requestFields(
fieldWithPath("[]")
.description("list of privileges to grant")
.type("Array<Privilege>"),
fieldWithPath("[].privilegeType")
.description("type of privilege (READ_PROJECT/WRITE_PROJECT)")
.type("String"),
fieldWithPath("[].login")
.description("user login who should gain access")
.type("String"))))
.andExpect(status().is2xxSuccessful());
assertTrue(curator.getPrivileges().contains(new Privilege(PrivilegeType.READ_PROJECT, TEST_PROJECT)));
......@@ -235,11 +247,23 @@ public class ProjectControllerIntegrationTest extends ControllerIntegrationTest
+ "\"login\":\"" + CURATOR_LOGIN + "\""
+ "}]";
RequestBuilder request = patch("/projects/" + TEST_PROJECT + ":revokePrivileges")
RequestBuilder request = patch("/projects/{projectId}:revokePrivileges", TEST_PROJECT)
.content(body)
.session(session);
mockMvc.perform(request)
.andDo(document("projects/project_privileges/revoke_privilege",
pathParameters(parameterWithName("projectId").description("project identifier")),
requestFields(
fieldWithPath("[]")
.description("list of privileges to revoke")
.type("Array<Privilege>"),
fieldWithPath("[].privilegeType")
.description("type of privilege (READ_PROJECT/WRITE_PROJECT)")
.type("String"),
fieldWithPath("[].login")
.description("user login who should lose access")
.type("String"))))
.andExpect(status().is2xxSuccessful());
assertFalse(curator.getPrivileges().contains(new Privilege(PrivilegeType.READ_PROJECT, TEST_PROJECT)));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment