Search in sources :

Example 11 with JsonOrganization

use of io.lumeer.api.dto.JsonOrganization in project engine by Lumeer.

the class OrganizationServicePermissionsIT method testRemoveGroupPermissionManageRole.

@Test
public void testRemoveGroupPermissionManageRole() {
    String name = "testRemoveGroupPermissionNoRole";
    String code = "testRemoveGroupPermissionNoRole_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 = "testGroup3";
    Response response = client.target(TARGET_URI).path(PATH_PREFIX + code + "/permissions/groups/" + group).request(MediaType.APPLICATION_JSON).buildDelete().invoke();
    assertThat(response.getStatusInfo()).isEqualTo(Response.Status.OK);
}
Also used : Response(javax.ws.rs.core.Response) Organization(io.lumeer.api.model.Organization) JsonOrganization(io.lumeer.api.dto.JsonOrganization) JsonOrganization(io.lumeer.api.dto.JsonOrganization) JsonPermission(io.lumeer.api.dto.JsonPermission) Test(org.junit.Test)

Example 12 with JsonOrganization

use of io.lumeer.api.dto.JsonOrganization in project engine by Lumeer.

the class OrganizationServicePermissionsIT method testCreateProjectInOrganizationManageRole.

@Test
public void testCreateProjectInOrganizationManageRole() {
    String name = "testCreateProjectInOrganizationManageRole";
    String code = "testCreateProjectInOrganizationManageRole_code";
    Organization organization = new JsonOrganization(code, name, "a", "b", null, null);
    organizationFacade.createOrganization(organization);
    String projectCode = "proj2";
    String projectName = "proj2_code";
    Project project = new JsonProject(projectCode, projectName, "a", "b", null, null);
    Response response = client.target(TARGET_URI).path(PATH_PREFIX + code + "/projects").request(MediaType.APPLICATION_JSON).buildPost(Entity.json(project)).invoke();
    assertThat(response.getStatusInfo()).isEqualTo(Response.Status.OK);
}
Also used : Response(javax.ws.rs.core.Response) JsonProject(io.lumeer.api.dto.JsonProject) Project(io.lumeer.api.model.Project) Organization(io.lumeer.api.model.Organization) JsonOrganization(io.lumeer.api.dto.JsonOrganization) JsonOrganization(io.lumeer.api.dto.JsonOrganization) JsonProject(io.lumeer.api.dto.JsonProject) Test(org.junit.Test)

Example 13 with JsonOrganization

use of io.lumeer.api.dto.JsonOrganization in project engine by Lumeer.

the class OrganizationServicePermissionsIT method testRemoveGroupPermissionNoRole.

@Test
public void testRemoveGroupPermissionNoRole() {
    String name = "testRemoveGroupPermissionNoRole";
    String code = "testRemoveGroupPermissionNoRole_code";
    Organization organization = new JsonOrganization(code, name, "a", "b", null, null);
    organizationFacade.createOrganization(organization);
    organizationFacade.removeUserPermission(code, userEmail);
    String group = "testGroup3";
    Response response = client.target(TARGET_URI).path(PATH_PREFIX + code + "/permissions/groups/" + group).request(MediaType.APPLICATION_JSON).buildDelete().invoke();
    assertThat(response.getStatusInfo()).isEqualTo(Response.Status.UNAUTHORIZED);
}
Also used : Response(javax.ws.rs.core.Response) Organization(io.lumeer.api.model.Organization) JsonOrganization(io.lumeer.api.dto.JsonOrganization) JsonOrganization(io.lumeer.api.dto.JsonOrganization) Test(org.junit.Test)

Example 14 with JsonOrganization

use of io.lumeer.api.dto.JsonOrganization in project engine by Lumeer.

the class OrganizationServicePermissionsIT method testRemoveUserPermissionNoRole.

@Test
public void testRemoveUserPermissionNoRole() {
    String name = "testRemoveUserPermissionNoRole";
    String code = "testRemoveUserPermissionNoRole_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 + "/permissions/users/" + userEmail).request(MediaType.APPLICATION_JSON).buildDelete().invoke();
    assertThat(response.getStatusInfo()).isEqualTo(Response.Status.UNAUTHORIZED);
}
Also used : Response(javax.ws.rs.core.Response) Organization(io.lumeer.api.model.Organization) JsonOrganization(io.lumeer.api.dto.JsonOrganization) JsonOrganization(io.lumeer.api.dto.JsonOrganization) Test(org.junit.Test)

Example 15 with JsonOrganization

use of io.lumeer.api.dto.JsonOrganization in project engine by Lumeer.

the class GroupServiceIT 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)))));
    organization = organizationDao.createOrganization(organization1);
    groupDao.createGroupsRepository(organization);
    groupDao.setOrganization(organization);
}
Also used : JsonPermissions(io.lumeer.api.dto.JsonPermissions) JsonOrganization(io.lumeer.api.dto.JsonOrganization) JsonPermission(io.lumeer.api.dto.JsonPermission) Before(org.junit.Before)

Aggregations

JsonOrganization (io.lumeer.api.dto.JsonOrganization)45 Organization (io.lumeer.api.model.Organization)40 JsonPermission (io.lumeer.api.dto.JsonPermission)28 Test (org.junit.Test)23 Response (javax.ws.rs.core.Response)21 JsonPermissions (io.lumeer.api.dto.JsonPermissions)18 Before (org.junit.Before)16 JsonProject (io.lumeer.api.dto.JsonProject)14 Project (io.lumeer.api.model.Project)13 AuthenticatedUser (io.lumeer.core.AuthenticatedUser)13 User (io.lumeer.api.model.User)12 JsonCollection (io.lumeer.api.dto.JsonCollection)8 Permission (io.lumeer.api.model.Permission)6 Role (io.lumeer.api.model.Role)4 SoftAssertions (org.assertj.core.api.SoftAssertions)4 Entity (javax.ws.rs.client.Entity)3 LinkType (io.lumeer.api.model.LinkType)2 SimplePermission (io.lumeer.core.model.SimplePermission)2 List (java.util.List)2 CompanyContact (io.lumeer.api.model.CompanyContact)1