Search in sources :

Example 16 with SimplePermission

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

the class ProjectServicePermissionsIT method createProject.

private Project createProject(String code, String name) {
    Project project = new JsonProject(code, name, "a", "b", null, null);
    project.getPermissions().updateUserPermissions(new SimplePermission(userEmail, Project.ROLES));
    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 17 with SimplePermission

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

the class ViewFacadeIT method testUpdateGroupPermissions.

@Test
public void testUpdateGroupPermissions() {
    createView(CODE);
    SimplePermission groupPermission = new SimplePermission(GROUP, new HashSet<>(Arrays.asList(Role.SHARE, Role.READ)));
    viewFacade.updateGroupPermissions(CODE, groupPermission);
    Permissions permissions = viewDao.getViewByCode(CODE).getPermissions();
    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 18 with SimplePermission

use of io.lumeer.core.model.SimplePermission 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);
}
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 19 with SimplePermission

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

the class OrganizationFacadeIT method testUpdateUserPermissions.

@Test
public void testUpdateUserPermissions() {
    createOrganization(CODE1);
    SimplePermission userPermission = new SimplePermission(USER, new HashSet<>(Arrays.asList(Role.MANAGE, Role.READ)));
    organizationFacade.updateUserPermissions(CODE1, userPermission);
    Permissions permissions = organizationDao.getOrganizationByCode(CODE1).getPermissions();
    assertThat(permissions).isNotNull();
    assertPermissions(permissions.getUserPermissions(), userPermission);
    assertPermissions(permissions.getGroupPermissions(), GROUP_PERMISSION);
}
Also used : Permissions(io.lumeer.api.model.Permissions) LumeerAssertions.assertPermissions(io.lumeer.test.util.LumeerAssertions.assertPermissions) SimplePermission(io.lumeer.core.model.SimplePermission) Test(org.junit.Test)

Example 20 with SimplePermission

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

the class OrganizationFacadeIT method testUpdateGroupPermissions.

@Test
public void testUpdateGroupPermissions() {
    createOrganization(CODE1);
    SimplePermission groupPermission = new SimplePermission(GROUP, new HashSet<>(Arrays.asList(Role.SHARE, Role.READ)));
    organizationFacade.updateGroupPermissions(CODE1, groupPermission);
    Permissions permissions = organizationDao.getOrganizationByCode(CODE1).getPermissions();
    assertThat(permissions).isNotNull();
    assertPermissions(permissions.getUserPermissions(), USER_PERMISSION);
    assertPermissions(permissions.getGroupPermissions(), groupPermission);
}
Also used : Permissions(io.lumeer.api.model.Permissions) LumeerAssertions.assertPermissions(io.lumeer.test.util.LumeerAssertions.assertPermissions) 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