use of io.lumeer.core.model.SimplePermission in project engine by Lumeer.
the class OrganizationFacade method createOrganization.
public Organization createOrganization(final Organization organization) {
// TODO check system role for creating organizations
Permission defaultUserPermission = new SimplePermission(authenticatedUser.getUserEmail(), Organization.ROLES);
organization.getPermissions().updateUserPermissions(defaultUserPermission);
Organization storedOrganization = organizationDao.createOrganization(organization);
createOrganizationScopedRepositories(storedOrganization);
return storedOrganization;
}
use of io.lumeer.core.model.SimplePermission in project engine by Lumeer.
the class ProjectFacade method createProject.
public Project createProject(Project project) {
checkOrganizationWriteRole();
Permission defaultUserPermission = new SimplePermission(authenticatedUser.getCurrentUsername(), Project.ROLES);
project.getPermissions().updateUserPermissions(defaultUserPermission);
Project storedProject = projectDao.createProject(project);
createProjectScopedRepositories(storedProject);
return storedProject;
}
use of io.lumeer.core.model.SimplePermission in project engine by Lumeer.
the class ViewFacade method createView.
public View createView(View view) {
if (view.getCode() == null || view.getCode().isEmpty()) {
view.setCode(this.generateViewCode(view.getName()));
}
Permission defaultUserPermission = new SimplePermission(authenticatedUser.getCurrentUsername(), View.ROLES);
view.getPermissions().updateUserPermissions(defaultUserPermission);
return viewDao.createView(view);
}
use of io.lumeer.core.model.SimplePermission in project engine by Lumeer.
the class CollectionFacade method createCollectionMetadata.
private Collection createCollectionMetadata(Collection collection) {
if (collection.getCode() == null || collection.getCode().isEmpty()) {
collection.setCode(generateCollectionCode(collection.getName()));
}
Permission defaultUserPermission = new SimplePermission(authenticatedUser.getCurrentUsername(), Collection.ROLES);
collection.getPermissions().updateUserPermissions(defaultUserPermission);
return collectionDao.createCollection(collection);
}
use of io.lumeer.core.model.SimplePermission in project engine by Lumeer.
the class CollectionFacadeIT method testUpdateGroupPermissions.
@Test
public void testUpdateGroupPermissions() {
String collectionId = createCollection(CODE).getId();
SimplePermission groupPermission = new SimplePermission(GROUP, new HashSet<>(Arrays.asList(Role.SHARE, Role.READ)));
collectionFacade.updateGroupPermissions(collectionId, groupPermission);
Permissions permissions = collectionDao.getCollectionByCode(CODE).getPermissions();
assertThat(permissions).isNotNull();
assertPermissions(permissions.getUserPermissions(), USER_PERMISSION);
assertPermissions(permissions.getGroupPermissions(), groupPermission);
}
Aggregations