use of io.lumeer.api.model.Permissions in project engine by Lumeer.
the class OrganizationServiceIT method testRemoveUserPermission.
@Test
public void testRemoveUserPermission() {
createOrganizationWithSpecificPermissions(CODE1);
Response response = client.target(PERMISSIONS_URL).path("users").path(USER).request(MediaType.APPLICATION_JSON).buildDelete().invoke();
assertThat(response).isNotNull();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.OK);
assertThat(response.getLinks()).extracting(Link::getUri).containsOnly(UriBuilder.fromUri(PERMISSIONS_URL).build());
Permissions permissions = organizationDao.getOrganizationByCode(CODE1).getPermissions();
assertThat(permissions.getUserPermissions()).isEmpty();
assertPermissions(permissions.getGroupPermissions(), GROUP_PERMISSION);
}
use of io.lumeer.api.model.Permissions in project engine by Lumeer.
the class ProjectServiceIT method testRemoveUserPermission.
@Test
public void testRemoveUserPermission() {
createProject(CODE1);
Response response = client.target(PERMISSIONS_URL).path("users").path(USER).request(MediaType.APPLICATION_JSON).buildDelete().invoke();
assertThat(response).isNotNull();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.OK);
assertThat(response.getLinks()).extracting(Link::getUri).containsOnly(UriBuilder.fromUri(PERMISSIONS_URL).build());
Permissions permissions = projectDao.getProjectByCode(CODE1).getPermissions();
assertThat(permissions.getUserPermissions()).isEmpty();
assertPermissions(permissions.getGroupPermissions(), GROUP_PERMISSION);
}
use of io.lumeer.api.model.Permissions in project engine by Lumeer.
the class ProjectServiceIT method testRemoveGroupPermission.
@Test
public void testRemoveGroupPermission() {
createProject(CODE1);
Response response = client.target(PERMISSIONS_URL).path("groups").path(GROUP).request(MediaType.APPLICATION_JSON).buildDelete().invoke();
assertThat(response).isNotNull();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.OK);
assertThat(response.getLinks()).extracting(Link::getUri).containsOnly(UriBuilder.fromUri(PERMISSIONS_URL).build());
Permissions permissions = projectDao.getProjectByCode(CODE1).getPermissions();
assertPermissions(permissions.getUserPermissions(), USER_PERMISSION);
assertThat(permissions.getGroupPermissions()).isEmpty();
}
use of io.lumeer.api.model.Permissions in project engine by Lumeer.
the class ProjectServiceIT method testGetProjectPermissions.
@Test
public void testGetProjectPermissions() {
createProject(CODE1);
Response response = client.target(PERMISSIONS_URL).request(MediaType.APPLICATION_JSON).buildGet().invoke();
assertThat(response).isNotNull();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.OK);
Permissions permissions = response.readEntity(JsonPermissions.class);
assertPermissions(permissions.getUserPermissions(), USER_PERMISSION);
assertPermissions(permissions.getGroupPermissions(), GROUP_PERMISSION);
}
use of io.lumeer.api.model.Permissions in project engine by Lumeer.
the class ViewServiceIT method testGetAllViews.
@Test
public void testGetAllViews() {
createView(CODE);
createView(CODE2);
Response response = client.target(VIEWS_URL).request(MediaType.APPLICATION_JSON).buildGet().invoke();
assertThat(response).isNotNull();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.OK);
List<JsonView> views = response.readEntity(new GenericType<List<JsonView>>() {
});
assertThat(views).extracting(Resource::getCode).containsOnly(CODE, CODE2);
Permissions permissions1 = views.get(0).getPermissions();
assertThat(permissions1).extracting(Permissions::getUserPermissions).containsOnly(Collections.singleton(USER_PERMISSION));
assertThat(permissions1).extracting(p -> p.getUserPermissions().iterator().next().getRoles()).containsOnly(USER_ROLES);
assertThat(permissions1).extracting(Permissions::getGroupPermissions).containsOnly(Collections.emptySet());
Permissions permissions2 = views.get(1).getPermissions();
assertThat(permissions2).extracting(Permissions::getUserPermissions).containsOnly(Collections.singleton(USER_PERMISSION));
assertThat(permissions2).extracting(p -> p.getUserPermissions().iterator().next().getRoles()).containsOnly(USER_ROLES);
assertThat(permissions2).extracting(Permissions::getGroupPermissions).containsOnly(Collections.emptySet());
}
Aggregations