use of io.lumeer.api.model.Organization in project engine by Lumeer.
the class OrganizationServiceIT method testCreateOrganization.
@Test
public void testCreateOrganization() {
Organization organization = new JsonOrganization(CODE1, NAME, ICON, COLOR, null, null);
Entity entity = Entity.json(organization);
Response response = client.target(ORGANIZATION_URL).request(MediaType.APPLICATION_JSON).buildPost(entity).invoke();
assertThat(response).isNotNull();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.OK);
Organization returnedOrganization = response.readEntity(JsonOrganization.class);
SoftAssertions assertions = new SoftAssertions();
assertions.assertThat(returnedOrganization.getCode()).isEqualTo(CODE1);
assertions.assertThat(returnedOrganization.getName()).isEqualTo(NAME);
assertions.assertThat(returnedOrganization.getIcon()).isEqualTo(ICON);
assertions.assertThat(returnedOrganization.getColor()).isEqualTo(COLOR);
assertions.assertThat(returnedOrganization.getPermissions().getUserPermissions()).containsOnly(USER_PERMISSION);
assertions.assertThat(returnedOrganization.getPermissions().getGroupPermissions()).isEmpty();
assertions.assertAll();
}
use of io.lumeer.api.model.Organization in project engine by Lumeer.
the class ViewServiceIT method configureProject.
@Before
public void configureProject() {
MorphiaOrganization organization = new MorphiaOrganization();
organization.setCode(ORGANIZATION_CODE);
organization.setPermissions(new MorphiaPermissions());
Organization storedOrganization = organizationDao.createOrganization(organization);
projectDao.setOrganization(storedOrganization);
User user = new User(USER);
userDao.createUser(user);
MorphiaProject project = new MorphiaProject();
project.setCode(PROJECT_CODE);
project.setPermissions(new MorphiaPermissions());
Project storedProject = projectDao.createProject(project);
viewDao.setProject(storedProject);
}
use of io.lumeer.api.model.Organization in project engine by Lumeer.
the class OrganizationServicePermissionsIT method testGetOrganizationNoRole.
@Test
public void testGetOrganizationNoRole() {
String name = "TestGetOrganizationNoRole";
String code = "TestGetOrganizationNoRole_code";
Organization organization = new JsonOrganization(code, name, "a", "b", null, null);
organizationFacade.createOrganization(organization);
organizationFacade.removeUserPermission(code, userEmail);
Response response = client.target(TARGET_URI).path(PATH_PREFIX + code).request(MediaType.APPLICATION_JSON).buildGet().invoke();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.UNAUTHORIZED);
}
use of io.lumeer.api.model.Organization in project engine by Lumeer.
the class OrganizationServicePermissionsIT method testUpdateGroupPermissionManageRole.
@Test
public void testUpdateGroupPermissionManageRole() {
String name = "testUpdateGroupPermissionNoRole";
String code = "testUpdateGroupPermissionNoRole_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 = "testGroup2";
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.OK);
}
use of io.lumeer.api.model.Organization in project engine by Lumeer.
the class OrganizationServicePermissionsIT method testUpdateOrganizationNoRole.
@Test
public void testUpdateOrganizationNoRole() {
String name = "TestUpdateOrganizationNoRole";
String code = "TestUpdateOrganizationNoRole_id";
String newName = "NewTestUpdateOrganizationNoRole";
Organization organization = new JsonOrganization(code, name, "a", "b", null, null);
organizationFacade.createOrganization(organization);
organizationFacade.removeUserPermission(code, userEmail);
Organization newOrganization = new JsonOrganization(code, newName, "c", "d", null, null);
Response response = client.target(TARGET_URI).path(PATH_PREFIX + code).request(MediaType.APPLICATION_JSON).buildPut(Entity.json(newOrganization)).invoke();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.UNAUTHORIZED);
}
Aggregations