use of io.lumeer.api.dto.JsonPermission in project engine by Lumeer.
the class OrganizationServicePermissionsIT method testUpdateUserPermissionManageRole.
@Test
public void testUpdateUserPermissionManageRole() {
String name = "testUpdateUserPermissionNoRole";
String code = "testUpdateUserPermissionNoRole_code";
Organization organization = new JsonOrganization(code, name, "a", "b", null, null);
organizationFacade.createOrganization(organization);
organizationFacade.updateUserPermissions(code, new JsonPermission(userEmail, Role.toStringRoles(new HashSet<>(Arrays.asList(Role.READ, Role.MANAGE)))));
Permission newPermission = new JsonPermission(userEmail, Role.toStringRoles(new HashSet<>(Collections.singletonList(Role.WRITE))));
Response response = client.target(TARGET_URI).path(PATH_PREFIX + code + "/permissions/users").request(MediaType.APPLICATION_JSON).buildPut(Entity.json(newPermission)).invoke();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.OK);
}
use of io.lumeer.api.dto.JsonPermission in project engine by Lumeer.
the class OrganizationServicePermissionsIT method testUpdateUserPermissionNoRole.
@Test
public void testUpdateUserPermissionNoRole() {
String name = "testUpdateUserPermissionNoRole";
String code = "testUpdateUserPermissionNoRole_code";
Organization organization = new JsonOrganization(code, name, "a", "b", null, null);
organizationFacade.createOrganization(organization);
organizationFacade.removeUserPermission(code, userEmail);
Permission newPermission = new JsonPermission(userEmail, Role.toStringRoles(new HashSet<>(Collections.singletonList(Role.WRITE))));
Response response = client.target(TARGET_URI).path(PATH_PREFIX + code + "/permissions/users").request(MediaType.APPLICATION_JSON).buildPut(Entity.json(newPermission)).invoke();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.UNAUTHORIZED);
}
use of io.lumeer.api.dto.JsonPermission in project engine by Lumeer.
the class OrganizationServicePermissionsIT method testRemoveGroupPermissionManageRole.
@Test
public void testRemoveGroupPermissionManageRole() {
String name = "testRemoveGroupPermissionNoRole";
String code = "testRemoveGroupPermissionNoRole_code";
Organization organization = new JsonOrganization(code, name, "a", "b", null, null);
organizationFacade.createOrganization(organization);
organizationFacade.updateUserPermissions(code, new JsonPermission(userEmail, Role.toStringRoles(new HashSet<>(Arrays.asList(Role.READ, Role.MANAGE)))));
String group = "testGroup3";
Response response = client.target(TARGET_URI).path(PATH_PREFIX + code + "/permissions/groups/" + group).request(MediaType.APPLICATION_JSON).buildDelete().invoke();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.OK);
}
use of io.lumeer.api.dto.JsonPermission in project engine by Lumeer.
the class ProjectServicePermissionsIT method testUpdateGroupPermissionsNoRole.
@Test
public void testUpdateGroupPermissionsNoRole() {
String projectCode = "testGetProjectPermissionsNoRole_code1";
String projectName = "testGetProjectPermissionsNoRole";
createProject(projectCode, projectName);
projectFacade.removeUserPermission(projectCode, userEmail);
String group = "testGroup4";
Permission newPermission = new JsonPermission(group, Role.toStringRoles(new HashSet<>(Arrays.asList(Role.WRITE))));
Response response = client.target(TARGET_URI).path(PATH_PREFIX + projectCode + "/permissions/groups").request(MediaType.APPLICATION_JSON).buildPut(Entity.json(newPermission)).invoke();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.UNAUTHORIZED);
}
use of io.lumeer.api.dto.JsonPermission in project engine by Lumeer.
the class ProjectServicePermissionsIT method testUpdateUserPermissionsNoRole.
@Test
public void testUpdateUserPermissionsNoRole() {
String projectCode = "testGetProjectPermissionsNoRole_code1";
String projectName = "testGetProjectPermissionsNoRole";
createProject(projectCode, projectName);
projectFacade.removeUserPermission(projectCode, userEmail);
Permission newPermission = new JsonPermission(userEmail, Role.toStringRoles(new HashSet<>(Arrays.asList(Role.WRITE))));
Response response = client.target(TARGET_URI).path(PATH_PREFIX + projectCode + "/permissions/users").request(MediaType.APPLICATION_JSON).buildPut(Entity.json(newPermission)).invoke();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.UNAUTHORIZED);
}
Aggregations