use of io.lumeer.api.model.Role in project engine by Lumeer.
the class OrganizationServicePermissionsIT method testGetOrganizationPermissionsManageRole.
@Test
public void testGetOrganizationPermissionsManageRole() {
String name = "testGetOrganizationPermissionsManageRole";
String code = "testGetOrganizationPermissionsManageRole_code";
Organization organization = new JsonOrganization(code, name, "a", "b", null, null);
organizationFacade.createOrganization(organization);
organizationFacade.updateUserPermissions(code, new JsonPermission(userEmail, Role.toStringRoles(new HashSet<Role>(Arrays.asList(Role.READ, Role.MANAGE)))));
Response response = client.target(TARGET_URI).path(PATH_PREFIX + code + "/permissions").request(MediaType.APPLICATION_JSON).buildGet().invoke();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.OK);
}
use of io.lumeer.api.model.Role in project engine by Lumeer.
the class OrganizationServicePermissionsIT method testRemoveUserPermissionManageRole.
@Test
public void testRemoveUserPermissionManageRole() {
String name = "testRemoveUserPermissionNoRole";
String code = "testRemoveUserPermissionNoRole_code";
Organization organization = new JsonOrganization(code, name, "a", "b", null, null);
organizationFacade.createOrganization(organization);
organizationFacade.updateUserPermissions(code, new JsonPermission(userEmail, Role.toStringRoles(new HashSet<Role>(Arrays.asList(Role.READ, Role.MANAGE)))));
Response response = client.target(TARGET_URI).path(PATH_PREFIX + code + "/permissions/users/" + userEmail).request(MediaType.APPLICATION_JSON).buildDelete().invoke();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.OK);
}
use of io.lumeer.api.model.Role in project engine by Lumeer.
the class OrganizationServicePermissionsIT method testUpdateOrganizationManageRole.
@Test
public void testUpdateOrganizationManageRole() {
String name = "TestUpdateOrganizationManageRole";
String code = "TestUpdateOrganizationManageRole_code";
String newName = "NewTestUpdateOrganizationManageRole";
Organization organization = new JsonOrganization(code, name, "a", "b", null, null);
organizationFacade.createOrganization(organization);
organizationFacade.updateUserPermissions(code, new JsonPermission(userEmail, Role.toStringRoles(new HashSet<Role>(Arrays.asList(Role.READ, Role.MANAGE)))));
Response response = client.target(TARGET_URI).path(PATH_PREFIX + code).request(MediaType.APPLICATION_JSON).buildPut(Entity.json(new JsonOrganization(code, newName, "c", "d", null, null))).invoke();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.OK);
Organization org = response.readEntity(JsonOrganization.class);
assertThat(org.getName()).isEqualTo(newName);
assertThat(org.getCode()).isEqualTo(code);
}
Aggregations