Search in sources :

Example 1 with Project

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

the class ProjectFacade method updateProject.

public Project updateProject(final String projectCode, final Project project) {
    Project storedProject = projectDao.getProjectByCode(projectCode);
    permissionsChecker.checkRole(storedProject, Role.MANAGE);
    keepStoredPermissions(project, storedProject.getPermissions());
    Project updatedProject = projectDao.updateProject(storedProject.getId(), project);
    return keepOnlyActualUserRoles(updatedProject);
}
Also used : Project(io.lumeer.api.model.Project)

Example 2 with Project

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

the class ProjectFacade method updateGroupPermissions.

public Set<Permission> updateGroupPermissions(final String projectCode, final Permission... groupPermissions) {
    Project project = projectDao.getProjectByCode(projectCode);
    permissionsChecker.checkRole(project, Role.MANAGE);
    project.getPermissions().updateGroupPermissions(groupPermissions);
    projectDao.updateProject(project.getId(), project);
    return project.getPermissions().getGroupPermissions();
}
Also used : Project(io.lumeer.api.model.Project)

Example 3 with Project

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

the class ProjectFacade method getProject.

public Project getProject(final String projectCode) {
    Project project = projectDao.getProjectByCode(projectCode);
    permissionsChecker.checkRole(project, Role.READ);
    return keepOnlyActualUserRoles(project);
}
Also used : Project(io.lumeer.api.model.Project)

Example 4 with Project

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

the class ProjectFacade method updateUserPermissions.

public Set<Permission> updateUserPermissions(final String projectCode, final Permission... userPermissions) {
    Project project = projectDao.getProjectByCode(projectCode);
    permissionsChecker.checkRole(project, Role.MANAGE);
    project.getPermissions().updateUserPermissions(userPermissions);
    projectDao.updateProject(project.getId(), project);
    return project.getPermissions().getUserPermissions();
}
Also used : Project(io.lumeer.api.model.Project)

Example 5 with Project

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

the class ProjectFacade method deleteProject.

public void deleteProject(final String projectCode) {
    Project project = projectDao.getProjectByCode(projectCode);
    permissionsChecker.checkRole(project, Role.MANAGE);
    deleleProjectScopedRepositories(project);
    projectDao.deleteProject(project.getId());
}
Also used : Project(io.lumeer.api.model.Project)

Aggregations

Project (io.lumeer.api.model.Project)46 JsonProject (io.lumeer.api.dto.JsonProject)28 Test (org.junit.Test)17 Organization (io.lumeer.api.model.Organization)16 Before (org.junit.Before)16 JsonPermission (io.lumeer.api.dto.JsonPermission)14 User (io.lumeer.api.model.User)14 AuthenticatedUser (io.lumeer.core.AuthenticatedUser)14 JsonOrganization (io.lumeer.api.dto.JsonOrganization)13 JsonPermissions (io.lumeer.api.dto.JsonPermissions)12 Response (javax.ws.rs.core.Response)9 JsonCollection (io.lumeer.api.dto.JsonCollection)8 MorphiaProject (io.lumeer.storage.mongodb.model.MorphiaProject)7 SoftAssertions (org.assertj.core.api.SoftAssertions)7 SimplePermission (io.lumeer.core.model.SimplePermission)4 Permission (io.lumeer.api.model.Permission)3 MorphiaOrganization (io.lumeer.storage.mongodb.model.MorphiaOrganization)3 MorphiaPermissions (io.lumeer.storage.mongodb.model.embedded.MorphiaPermissions)3 Entity (javax.ws.rs.client.Entity)3 LinkType (io.lumeer.api.model.LinkType)2