use of io.lumeer.api.dto.JsonOrganization in project engine by Lumeer.
the class OrganizationServicePermissionsIT method testUpdateGroupPermissionNoRole.
@Test
public void testUpdateGroupPermissionNoRole() {
String name = "testUpdateGroupPermissionNoRole";
String code = "testUpdateGroupPermissionNoRole_code";
Organization organization = new JsonOrganization(code, name, "a", "b", null, null);
organizationFacade.createOrganization(organization);
organizationFacade.removeUserPermission(code, userEmail);
String group = "testGroup1";
Permission newPermission = new JsonPermission(group, Role.toStringRoles(new HashSet<>(Collections.singletonList(Role.WRITE))));
Response response = client.target(TARGET_URI).path(PATH_PREFIX + code + "/permissions/groups").request(MediaType.APPLICATION_JSON).buildPut(Entity.json(newPermission)).invoke();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.UNAUTHORIZED);
}
use of io.lumeer.api.dto.JsonOrganization in project engine by Lumeer.
the class ProjectServicePermissionsIT method testGetProjectReadRole.
@Test
public void testGetProjectReadRole() {
String projectCode = "testGetProjectReadRole_code";
String projectName = "testGetProjectReadRole";
createProject(projectCode, projectName);
projectFacade.updateUserPermissions(projectCode, new JsonPermission(userEmail, Role.toStringRoles(new HashSet<>(Arrays.asList(Role.READ)))));
Response response = client.target(TARGET_URI).path(PATH_PREFIX + projectCode).request(MediaType.APPLICATION_JSON).buildGet().invoke();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.OK);
JsonOrganization fetchedProject = response.readEntity(JsonOrganization.class);
assertThat(fetchedProject.getCode()).isEqualTo(projectCode);
assertThat(fetchedProject.getName()).isEqualTo(projectName);
}
use of io.lumeer.api.dto.JsonOrganization in project engine by Lumeer.
the class SearchFacadeIT method configureCollections.
@Before
public void configureCollections() {
JsonOrganization organization = new JsonOrganization();
organization.setCode(ORGANIZATION_CODE);
organization.setPermissions(new JsonPermissions());
Organization storedOrganization = organizationDao.createOrganization(organization);
projectDao.setOrganization(storedOrganization);
User user = new User(USER);
userDao.createUser(user);
JsonProject project = new JsonProject();
project.setPermissions(new JsonPermissions());
project.setCode(PROJECT_CODE);
Project storedProject = projectDao.createProject(project);
workspaceKeeper.setWorkspace(ORGANIZATION_CODE, PROJECT_CODE);
collectionDao.setProject(storedProject);
collectionDao.createCollectionsRepository(storedProject);
documentDao.setProject(storedProject);
collectionIds.clear();
for (String name : COLLECTION_CODES) {
JsonPermissions collectionPermissions = new JsonPermissions();
collectionPermissions.updateUserPermissions(new JsonPermission(USER, Project.ROLES.stream().map(Role::toString).collect(Collectors.toSet())));
JsonCollection jsonCollection = new JsonCollection(name, name, COLLECTION_ICON, COLLECTION_COLOR, collectionPermissions);
jsonCollection.setDocumentsCount(0);
String collectionId = collectionDao.createCollection(jsonCollection).getId();
collectionIds.add(collectionId);
dataDao.createDataRepository(collectionId);
}
}
use of io.lumeer.api.dto.JsonOrganization in project engine by Lumeer.
the class SuggestionFacadeIT method configure.
@Before
public void configure() {
JsonOrganization organization = new JsonOrganization();
organization.setCode(ORGANIZATION_CODE);
organization.setPermissions(new JsonPermissions());
Organization storedOrganization = organizationDao.createOrganization(organization);
projectDao.setOrganization(storedOrganization);
User user = new User(USER);
userDao.createUser(user);
JsonProject project = new JsonProject();
project.setPermissions(new JsonPermissions());
project.setCode(PROJECT_CODE);
Project storedProject = projectDao.createProject(project);
workspaceKeeper.setWorkspace(ORGANIZATION_CODE, PROJECT_CODE);
collectionDao.setProject(storedProject);
collectionDao.createCollectionsRepository(storedProject);
linkTypeDao.setProject(storedProject);
linkTypeDao.createLinkTypeRepository(storedProject);
viewDao.setProject(storedProject);
viewDao.createViewsRepository(storedProject);
collectionIds.clear();
for (String name : COLLECTION_NAMES) {
JsonPermissions collectionPermissions = new JsonPermissions();
collectionPermissions.updateUserPermissions(new JsonPermission(USER, Project.ROLES.stream().map(Role::toString).collect(Collectors.toSet())));
JsonCollection jsonCollection = new JsonCollection(name, name, COLLECTION_ICON, COLLECTION_COLOR, collectionPermissions);
jsonCollection.setDocumentsCount(0);
collectionIds.add(collectionDao.createCollection(jsonCollection).getId());
}
for (String name : COLLECTION_NAMES_NO_RIGHTS) {
JsonCollection jsonCollection = new JsonCollection(name, name, COLLECTION_ICON, COLLECTION_COLOR, new JsonPermissions());
jsonCollection.setDocumentsCount(0);
collectionIdsNoRights.add(collectionDao.createCollection(jsonCollection).getId());
}
}
use of io.lumeer.api.dto.JsonOrganization in project engine by Lumeer.
the class UserFacadeIT method configure.
@Before
public void configure() {
JsonOrganization organization1 = new JsonOrganization();
organization1.setCode("LMR");
organization1.setPermissions(new JsonPermissions());
organization1.getPermissions().updateUserPermissions(new JsonPermission(USER, Role.toStringRoles(new HashSet<>(Arrays.asList(Role.WRITE, Role.READ, Role.MANAGE)))));
organizationId1 = organizationDao.createOrganization(organization1).getId();
JsonOrganization organization2 = new JsonOrganization();
organization2.setCode("MRL");
organization2.setPermissions(new JsonPermissions());
organization2.getPermissions().updateUserPermissions(new JsonPermission(USER, Role.toStringRoles(new HashSet<>(Arrays.asList(Role.WRITE, Role.READ, Role.MANAGE)))));
organizationId2 = organizationDao.createOrganization(organization2).getId();
JsonOrganization organization3 = new JsonOrganization();
organization3.setCode("RML");
organization3.setPermissions(new JsonPermissions());
organizationIdNotPermission = organizationDao.createOrganization(organization3).getId();
}
Aggregations