Search in sources :

Example 16 with JsonPermissions

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

the class ConfigurationFacadeIT method setUp.

@Before
public void setUp() {
    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.setCode(PROJECT_CODE);
    JsonPermissions projectPermissions = new JsonPermissions();
    projectPermissions.updateUserPermissions(new JsonPermission(USER, Project.ROLES.stream().map(Role::toString).collect(Collectors.toSet())));
    project.setPermissions(projectPermissions);
    projectDao.createProject(project);
    workspaceKeeper.setWorkspace(ORGANIZATION_CODE, PROJECT_CODE);
}
Also used : JsonPermissions(io.lumeer.api.dto.JsonPermissions) Organization(io.lumeer.api.model.Organization) JsonOrganization(io.lumeer.api.dto.JsonOrganization) User(io.lumeer.api.model.User) AuthenticatedUser(io.lumeer.core.AuthenticatedUser) JsonOrganization(io.lumeer.api.dto.JsonOrganization) JsonPermission(io.lumeer.api.dto.JsonPermission) JsonProject(io.lumeer.api.dto.JsonProject) Before(org.junit.Before)

Example 17 with JsonPermissions

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

the class DocumentFacadeIT method configureCollection.

@Before
public void configureCollection() {
    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.setCode(PROJECT_CODE);
    JsonPermissions projectPermissions = new JsonPermissions();
    projectPermissions.updateUserPermissions(new JsonPermission(USER, Project.ROLES.stream().map(Role::toString).collect(Collectors.toSet())));
    project.setPermissions(projectPermissions);
    Project storedProject = projectDao.createProject(project);
    workspaceKeeper.setWorkspace(ORGANIZATION_CODE, PROJECT_CODE);
    collectionDao.setProject(storedProject);
    collectionDao.createCollectionsRepository(storedProject);
    JsonPermissions collectionPermissions = new JsonPermissions();
    collectionPermissions.updateUserPermissions(new JsonPermission(USER, Project.ROLES.stream().map(Role::toString).collect(Collectors.toSet())));
    JsonCollection jsonCollection = new JsonCollection(null, COLLECTION_NAME, COLLECTION_ICON, COLLECTION_COLOR, collectionPermissions);
    jsonCollection.setDocumentsCount(0);
    collection = collectionDao.createCollection(jsonCollection);
}
Also used : JsonProject(io.lumeer.api.dto.JsonProject) Project(io.lumeer.api.model.Project) JsonPermissions(io.lumeer.api.dto.JsonPermissions) Organization(io.lumeer.api.model.Organization) JsonOrganization(io.lumeer.api.dto.JsonOrganization) User(io.lumeer.api.model.User) AuthenticatedUser(io.lumeer.core.AuthenticatedUser) JsonOrganization(io.lumeer.api.dto.JsonOrganization) JsonPermission(io.lumeer.api.dto.JsonPermission) JsonCollection(io.lumeer.api.dto.JsonCollection) JsonProject(io.lumeer.api.dto.JsonProject) Before(org.junit.Before)

Example 18 with JsonPermissions

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

the class GroupFacadeIT 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);
    workspaceKeeper.setOrganization(organization.getCode());
    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)

Example 19 with JsonPermissions

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

the class GroupFacadeIT method setOrganizationWithoutPermissions.

private void setOrganizationWithoutPermissions() {
    JsonOrganization organization3 = new JsonOrganization();
    organization3.setCode("RML");
    organization3.setPermissions(new JsonPermissions());
    Organization organizationNotPermission = organizationDao.createOrganization(organization3);
    workspaceKeeper.setOrganization(organizationNotPermission.getCode());
    groupDao.createGroupsRepository(organizationNotPermission);
    groupDao.setOrganization(organizationNotPermission);
}
Also used : JsonPermissions(io.lumeer.api.dto.JsonPermissions) Organization(io.lumeer.api.model.Organization) JsonOrganization(io.lumeer.api.dto.JsonOrganization) JsonOrganization(io.lumeer.api.dto.JsonOrganization)

Aggregations

JsonPermissions (io.lumeer.api.dto.JsonPermissions)19 JsonOrganization (io.lumeer.api.dto.JsonOrganization)17 JsonPermission (io.lumeer.api.dto.JsonPermission)16 Before (org.junit.Before)16 Organization (io.lumeer.api.model.Organization)13 JsonProject (io.lumeer.api.dto.JsonProject)12 User (io.lumeer.api.model.User)12 AuthenticatedUser (io.lumeer.core.AuthenticatedUser)12 Project (io.lumeer.api.model.Project)11 JsonCollection (io.lumeer.api.dto.JsonCollection)8 LinkType (io.lumeer.api.model.LinkType)2 Document (org.bson.Document)2 JsonQuery (io.lumeer.api.dto.JsonQuery)1 JsonView (io.lumeer.api.dto.JsonView)1 Permission (io.lumeer.api.model.Permission)1