use of io.lumeer.api.model.Permissions in project engine by Lumeer.
the class ViewServiceIT method testUpdateGroupPermissions.
@Test
public void testUpdateGroupPermissions() {
createView(CODE);
SimplePermission groupPermission = new SimplePermission(GROUP, new HashSet<>(Arrays.asList(Role.SHARE, Role.READ)));
Entity entity = Entity.json(groupPermission);
Response response = client.target(PERMISSIONS_URL).path("groups").request(MediaType.APPLICATION_JSON).buildPut(entity).invoke();
assertThat(response).isNotNull();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.OK);
Set<JsonPermission> returnedPermissions = response.readEntity(new GenericType<Set<JsonPermission>>() {
});
assertThat(returnedPermissions).isNotNull().hasSize(1);
assertPermissions(Collections.unmodifiableSet(returnedPermissions), groupPermission);
Permissions storedPermissions = viewDao.getViewByCode(CODE).getPermissions();
assertThat(storedPermissions).isNotNull();
assertPermissions(storedPermissions.getUserPermissions(), USER_PERMISSION);
assertPermissions(storedPermissions.getGroupPermissions(), groupPermission);
}
use of io.lumeer.api.model.Permissions in project engine by Lumeer.
the class ViewServiceIT method testRemoveUserPermission.
@Test
public void testRemoveUserPermission() {
createView(CODE);
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 = viewDao.getViewByCode(CODE).getPermissions();
assertThat(permissions.getUserPermissions()).isEmpty();
assertPermissions(permissions.getGroupPermissions(), GROUP_PERMISSION);
}
use of io.lumeer.api.model.Permissions in project engine by Lumeer.
the class ViewServiceIT method testRemoveGroupPermission.
@Test
public void testRemoveGroupPermission() {
createView(CODE);
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 = viewDao.getViewByCode(CODE).getPermissions();
assertPermissions(permissions.getUserPermissions(), USER_PERMISSION);
assertThat(permissions.getGroupPermissions()).isEmpty();
}
use of io.lumeer.api.model.Permissions in project engine by Lumeer.
the class ViewFacadeIT method testRemoveUserPermission.
@Test
public void testRemoveUserPermission() {
createView(CODE);
viewFacade.removeUserPermission(CODE, USER);
Permissions permissions = viewDao.getViewByCode(CODE).getPermissions();
assertThat(permissions).isNotNull();
assertThat(permissions.getUserPermissions()).isEmpty();
assertPermissions(permissions.getGroupPermissions(), GROUP_PERMISSION);
}
use of io.lumeer.api.model.Permissions in project engine by Lumeer.
the class ViewFacadeIT method testRemoveGroupPermission.
@Test
public void testRemoveGroupPermission() {
createView(CODE);
viewFacade.removeGroupPermission(CODE, GROUP);
Permissions permissions = viewDao.getViewByCode(CODE).getPermissions();
assertThat(permissions).isNotNull();
assertPermissions(permissions.getUserPermissions(), USER_PERMISSION);
assertThat(permissions.getGroupPermissions()).isEmpty();
}
Aggregations