use of io.lumeer.api.dto.JsonPermissions in project engine by Lumeer.
the class ViewCodec method decode.
@Override
public JsonView decode(final BsonReader reader, final DecoderContext decoderContext) {
Document bson = documentCodec.decode(reader, decoderContext);
String id = bson.getObjectId(ID).toHexString();
String code = bson.getString(CODE);
String name = bson.getString(NAME);
String icon = bson.getString(ICON);
String color = bson.getString(COLOR);
String description = bson.getString(DESCRIPTION);
// TODO try to use better approach
JsonPermissions permissions = PermissionsCodec.convertFromDocument(bson.get(PERMISSIONS, Document.class));
JsonQuery query = QueryCodec.convertFromDocument(bson.get(QUERY, Document.class));
String perspective = bson.getString(PERSPECTIVE);
Object config = bson.get(CONFIG);
JsonView view = new JsonView(code, name, icon, color, description, permissions, query, perspective, config);
view.setId(id);
return view;
}
use of io.lumeer.api.dto.JsonPermissions in project engine by Lumeer.
the class ImportFacadeIT 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, 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);
}
use of io.lumeer.api.dto.JsonPermissions in project engine by Lumeer.
the class LinkInstanceFacadeIT method configureLinkInstances.
@Before
public void configureLinkInstances() {
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.setPermissions(new JsonPermissions());
project.setCode(PROJECT_CODE);
Project storedProject = projectDao.createProject(project);
workspaceKeeper.setWorkspace(ORGANIZATION_CODE, PROJECT_CODE);
collectionDao.setProject(storedProject);
JsonPermissions collectionPermissions = new JsonPermissions();
collectionPermissions.updateUserPermissions(new JsonPermission(USER, Project.ROLES.stream().map(Role::toString).collect(Collectors.toSet())));
JsonCollection jsonCollection = new JsonCollection("col1", "col1", "icon", "color", collectionPermissions);
jsonCollection.setDocumentsCount(0);
String collection1 = collectionDao.createCollection(jsonCollection).getId();
JsonCollection jsonCollection2 = new JsonCollection("col2", "col2", "icon", "color", collectionPermissions);
jsonCollection.setDocumentsCount(0);
String collection2 = collectionDao.createCollection(jsonCollection2).getId();
LinkType linkType = new LinkType(null, NAME, Arrays.asList(collection1, collection2), ATTRIBUTES);
linkTypeId1 = linkTypeDao.createLinkType(linkType).getId();
LinkType linkType2 = new LinkType(null, NAME2, Arrays.asList(collection1, collection2), ATTRIBUTES);
linkTypeId2 = linkTypeDao.createLinkType(linkType2).getId();
documentIdsColl1.clear();
for (int i = 0; i < 3; i++) {
documentIdsColl1.add(createDocument(collection1).getId());
}
documentIdsColl2.clear();
for (int i = 0; i < 3; i++) {
documentIdsColl2.add(createDocument(collection2).getId());
}
}
use of io.lumeer.api.dto.JsonPermissions in project engine by Lumeer.
the class LinkTypeFacadeIT method configureLinkTypes.
@Before
public void configureLinkTypes() {
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.setPermissions(new JsonPermissions());
project.setCode(PROJECT_CODE);
Project storedProject = projectDao.createProject(project);
workspaceKeeper.setWorkspace(ORGANIZATION_CODE, PROJECT_CODE);
collectionDao.setProject(storedProject);
collectionIds.clear();
for (String name : COLLECTION_NAMES) {
JsonPermissions collectionPermissions = new JsonPermissions();
collectionPermissions.updateUserPermissions(new JsonPermission(USER, Project.ROLES.stream().map(Role::toString).collect(Collectors.toSet())));
JsonCollection jsonCollection = new JsonCollection(name, name, COLLECTION_ICON, COLLECTION_COLOR, collectionPermissions);
jsonCollection.setDocumentsCount(0);
collectionIds.add(collectionDao.createCollection(jsonCollection).getId());
}
}
use of io.lumeer.api.dto.JsonPermissions in project engine by Lumeer.
the class GroupServiceIT 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);
groupDao.createGroupsRepository(organization);
groupDao.setOrganization(organization);
}
Aggregations