Search in sources :

Example 46 with User

use of io.lumeer.api.model.User in project engine by Lumeer.

the class DocumentServiceIT 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);
    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(COLLECTION_CODE, COLLECTION_NAME, COLLECTION_ICON, COLLECTION_COLOR, collectionPermissions);
    collection = collectionDao.createCollection(jsonCollection);
    documentDao.setProject(storedProject);
}
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 47 with User

use of io.lumeer.api.model.User in project engine by Lumeer.

the class CollectionFacadeIT method configureProject.

@Before
public void configureProject() {
    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, Role.toStringRoles(Project.ROLES)));
    project.setPermissions(projectPermissions);
    Project storedProject = projectDao.createProject(project);
    workspaceKeeper.setWorkspace(ORGANIZATION_CODE, PROJECT_CODE);
    collectionDao.setProject(storedProject);
}
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) JsonProject(io.lumeer.api.dto.JsonProject) Before(org.junit.Before)

Example 48 with User

use of io.lumeer.api.model.User 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 49 with User

use of io.lumeer.api.model.User 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 50 with User

use of io.lumeer.api.model.User in project engine by Lumeer.

the class GroupFacadeIT method prepareUser.

private User prepareUser(String user, Set<String> groups) {
    User u = new User(user);
    u.setName(user);
    u.setGroups(Collections.singletonMap(organization.getId(), groups));
    return u;
}
Also used : User(io.lumeer.api.model.User) AuthenticatedUser(io.lumeer.core.AuthenticatedUser)

Aggregations

User (io.lumeer.api.model.User)50 AuthenticatedUser (io.lumeer.core.AuthenticatedUser)29 Test (org.junit.Test)21 Before (org.junit.Before)18 Organization (io.lumeer.api.model.Organization)17 JsonOrganization (io.lumeer.api.dto.JsonOrganization)13 Project (io.lumeer.api.model.Project)13 JsonPermission (io.lumeer.api.dto.JsonPermission)12 JsonPermissions (io.lumeer.api.dto.JsonPermissions)12 JsonProject (io.lumeer.api.dto.JsonProject)12 JsonCollection (io.lumeer.api.dto.JsonCollection)8 HashSet (java.util.HashSet)7 MorphiaOrganization (io.lumeer.storage.mongodb.model.MorphiaOrganization)5 MorphiaPermissions (io.lumeer.storage.mongodb.model.embedded.MorphiaPermissions)5 Set (java.util.Set)5 Response (javax.ws.rs.core.Response)4 MorphiaPermission (io.lumeer.storage.mongodb.model.embedded.MorphiaPermission)3 HashMap (java.util.HashMap)3 LinkType (io.lumeer.api.model.LinkType)2 MorphiaProject (io.lumeer.storage.mongodb.model.MorphiaProject)2