use of io.lumeer.api.model.Permissions in project engine by Lumeer.
the class ViewFacadeIT method testUpdateUserPermissions.
@Test
public void testUpdateUserPermissions() {
createView(CODE);
SimplePermission userPermission = new SimplePermission(USER, new HashSet<>(Arrays.asList(Role.MANAGE, Role.READ)));
viewFacade.updateUserPermissions(CODE, userPermission);
Permissions permissions = viewDao.getViewByCode(CODE).getPermissions();
assertThat(permissions).isNotNull();
assertPermissions(permissions.getUserPermissions(), userPermission);
assertPermissions(permissions.getGroupPermissions(), GROUP_PERMISSION);
}
use of io.lumeer.api.model.Permissions in project engine by Lumeer.
the class ViewFacadeIT method testGetViewPermissions.
@Test
public void testGetViewPermissions() {
createView(CODE);
Permissions permissions = viewFacade.getViewPermissions(CODE);
assertThat(permissions).isNotNull();
assertPermissions(permissions.getUserPermissions(), USER_PERMISSION);
assertPermissions(permissions.getGroupPermissions(), GROUP_PERMISSION);
}
use of io.lumeer.api.model.Permissions in project engine by Lumeer.
the class CollectionServiceIT method testRemoveUserPermission.
@Test
public void testRemoveUserPermission() {
String collectionId = createCollection(CODE).getId();
Response response = client.target(COLLECTIONS_URL).path(collectionId).path("permissions").path("users").path(USER).request(MediaType.APPLICATION_JSON).buildDelete().invoke();
assertThat(response).isNotNull();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.OK);
Permissions permissions = collectionDao.getCollectionByCode(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 CollectionServiceIT method testRemoveGroupPermission.
@Test
public void testRemoveGroupPermission() {
String collectionId = createCollection(CODE).getId();
Response response = client.target(COLLECTIONS_URL).path(collectionId).path("permissions").path("groups").path(GROUP).request(MediaType.APPLICATION_JSON).buildDelete().invoke();
assertThat(response).isNotNull();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.OK);
Permissions permissions = collectionDao.getCollectionByCode(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 CollectionServiceIT method testGetCollectionPermissions.
@Test
public void testGetCollectionPermissions() {
String collectionId = createCollection(CODE).getId();
Response response = client.target(COLLECTIONS_URL).path(collectionId).path("permissions").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);
}
Aggregations