Search in sources :

Example 21 with SimplePermission

use of io.lumeer.core.model.SimplePermission in project engine by Lumeer.

the class OrganizationFacadeIT method createOrganizationWithStrangerPermissions.

private void createOrganizationWithStrangerPermissions(final String code) {
    Organization organization = new JsonOrganization(code, NAME, ICON, COLOR, null, null);
    organization.getPermissions().updateUserPermissions(USER_PERMISSION, new SimplePermission(STRANGER_USER, Collections.singleton(Role.MANAGE)));
    organization.getPermissions().updateGroupPermissions(GROUP_PERMISSION);
    organizationDao.createOrganization(organization);
}
Also used : JsonOrganization(io.lumeer.api.dto.JsonOrganization) Organization(io.lumeer.api.model.Organization) JsonOrganization(io.lumeer.api.dto.JsonOrganization) SimplePermission(io.lumeer.core.model.SimplePermission)

Example 22 with SimplePermission

use of io.lumeer.core.model.SimplePermission in project engine by Lumeer.

the class ProjectFacadeIT method testUpdateGroupPermissions.

@Test
public void testUpdateGroupPermissions() {
    createProject(CODE1);
    SimplePermission groupPermission = new SimplePermission(GROUP, new HashSet<>(Arrays.asList(Role.SHARE, Role.READ)));
    projectFacade.updateGroupPermissions(CODE1, groupPermission);
    Permissions permissions = projectDao.getProjectByCode(CODE1).getPermissions();
    Assertions.assertThat(permissions).isNotNull();
    assertPermissions(permissions.getUserPermissions(), USER_PERMISSION);
    assertPermissions(permissions.getGroupPermissions(), groupPermission);
}
Also used : LumeerAssertions.assertPermissions(io.lumeer.test.util.LumeerAssertions.assertPermissions) MorphiaPermissions(io.lumeer.storage.mongodb.model.embedded.MorphiaPermissions) Permissions(io.lumeer.api.model.Permissions) SimplePermission(io.lumeer.core.model.SimplePermission) Test(org.junit.Test)

Example 23 with SimplePermission

use of io.lumeer.core.model.SimplePermission in project engine by Lumeer.

the class ProjectFacadeIT method createProjectWithStrangerPermissions.

private Project createProjectWithStrangerPermissions(final String code) {
    Project project = new JsonProject(code, NAME, ICON, COLOR, null, null);
    project.getPermissions().updateUserPermissions(USER_PERMISSION, new SimplePermission(STRANGER_USER, Collections.singleton(Role.MANAGE)));
    project.getPermissions().updateGroupPermissions(GROUP_PERMISSION);
    return projectDao.createProject(project);
}
Also used : JsonProject(io.lumeer.api.dto.JsonProject) Project(io.lumeer.api.model.Project) JsonProject(io.lumeer.api.dto.JsonProject) SimplePermission(io.lumeer.core.model.SimplePermission)

Example 24 with SimplePermission

use of io.lumeer.core.model.SimplePermission in project engine by Lumeer.

the class ProjectFacadeIT method testUpdateUserPermissions.

@Test
public void testUpdateUserPermissions() {
    createProject(CODE1);
    SimplePermission userPermission = new SimplePermission(USER, new HashSet<>(Arrays.asList(Role.MANAGE, Role.READ)));
    projectFacade.updateUserPermissions(CODE1, userPermission);
    Permissions permissions = projectDao.getProjectByCode(CODE1).getPermissions();
    Assertions.assertThat(permissions).isNotNull();
    assertPermissions(permissions.getUserPermissions(), userPermission);
    assertPermissions(permissions.getGroupPermissions(), GROUP_PERMISSION);
}
Also used : LumeerAssertions.assertPermissions(io.lumeer.test.util.LumeerAssertions.assertPermissions) MorphiaPermissions(io.lumeer.storage.mongodb.model.embedded.MorphiaPermissions) Permissions(io.lumeer.api.model.Permissions) SimplePermission(io.lumeer.core.model.SimplePermission) Test(org.junit.Test)

Aggregations

SimplePermission (io.lumeer.core.model.SimplePermission)24 Permissions (io.lumeer.api.model.Permissions)16 LumeerAssertions.assertPermissions (io.lumeer.test.util.LumeerAssertions.assertPermissions)16 Test (org.junit.Test)16 JsonPermissions (io.lumeer.api.dto.JsonPermissions)10 JsonPermission (io.lumeer.api.dto.JsonPermission)8 MorphiaPermissions (io.lumeer.storage.mongodb.model.embedded.MorphiaPermissions)8 HashSet (java.util.HashSet)8 Set (java.util.Set)8 Entity (javax.ws.rs.client.Entity)8 Response (javax.ws.rs.core.Response)8 Permission (io.lumeer.api.model.Permission)5 Project (io.lumeer.api.model.Project)3 JsonProject (io.lumeer.api.dto.JsonProject)2 Organization (io.lumeer.api.model.Organization)2 JsonOrganization (io.lumeer.api.dto.JsonOrganization)1 Role (io.lumeer.api.model.Role)1