use of io.lumeer.storage.mongodb.model.MorphiaOrganization in project engine by Lumeer.
the class MorphiaOrganizationDaoTest method prepareOrganization.
private MorphiaOrganization prepareOrganization(String code) {
MorphiaOrganization organization = new MorphiaOrganization();
organization.setCode(code);
organization.setName(NAME);
organization.setColor(COLOR);
organization.setIcon(ICON);
organization.setPermissions(new MorphiaPermissions(PERMISSIONS));
return organization;
}
use of io.lumeer.storage.mongodb.model.MorphiaOrganization in project engine by Lumeer.
the class MorphiaOrganizationDaoTest method testUpdateOrganizationPermissions.
@Test
public void testUpdateOrganizationPermissions() {
MorphiaOrganization organization = prepareOrganization(CODE1);
String id = datastore.save(organization).getId().toString();
assertThat(id).isNotNull().isNotEmpty();
organization.getPermissions().removeUserPermission(USER);
organization.getPermissions().updateGroupPermissions(GROUP_PERMISSION);
organizationDao.updateOrganization(id, organization);
MorphiaOrganization storedOrganization = datastore.get(MorphiaOrganization.class, new ObjectId(id));
assertThat(storedOrganization).isNotNull();
assertThat(storedOrganization.getPermissions().getUserPermissions()).isEmpty();
assertThat(storedOrganization.getPermissions().getGroupPermissions()).containsExactly(GROUP_PERMISSION);
}
use of io.lumeer.storage.mongodb.model.MorphiaOrganization in project engine by Lumeer.
the class MorphiaOrganizationDao method createOrganization.
@Override
public Organization createOrganization(final Organization organization) {
MorphiaOrganization morphiaOrganization = new MorphiaOrganization(organization);
datastore.insert(morphiaOrganization);
return morphiaOrganization;
}
use of io.lumeer.storage.mongodb.model.MorphiaOrganization in project engine by Lumeer.
the class ProjectFacadeIT method configureProject.
@Before
public void configureProject() {
MorphiaOrganization organization = new MorphiaOrganization();
organization.setCode(ORGANIZATION_CODE);
organization.setPermissions(new MorphiaPermissions());
organization.getPermissions().updateUserPermissions(new MorphiaPermission(USER, Role.toStringRoles(new HashSet<>(Arrays.asList(Role.WRITE, Role.READ, Role.MANAGE)))));
Organization storedOrganization = organizationDao.createOrganization(organization);
projectDao.setOrganization(storedOrganization);
User user = new User(USER);
userDao.createUser(user);
workspaceKeeper.setOrganization(ORGANIZATION_CODE);
}
use of io.lumeer.storage.mongodb.model.MorphiaOrganization in project engine by Lumeer.
the class ProjectServiceIT method configureProject.
@Before
public void configureProject() {
MorphiaOrganization organization = new MorphiaOrganization();
organization.setCode(ORGANIZATION_CODE);
organization.setPermissions(new MorphiaPermissions());
organization.getPermissions().updateUserPermissions(new MorphiaPermission(USER, Role.toStringRoles(new HashSet<>(Arrays.asList(Role.WRITE, Role.READ, Role.MANAGE)))));
Organization storedOrganization = organizationDao.createOrganization(organization);
projectDao.setOrganization(storedOrganization);
User user = new User(USER);
userDao.createUser(user);
}
Aggregations