use of io.lumeer.api.model.User in project engine by Lumeer.
the class UserFacadeIT method testUpdateNameAndEmail.
@Test
public void testUpdateNameAndEmail() {
String userId = createUser(organizationId1, USER1).getId();
User toUpdate = prepareUser(organizationId1, USER1);
toUpdate.setEmail(USER3);
toUpdate.setName("newName");
userFacade.updateUser(organizationId1, userId, toUpdate);
User storedNotExisting = getUser(organizationId1, USER1);
assertThat(storedNotExisting).isNull();
User storedExisting = getUser(organizationId1, USER3);
assertThat(storedExisting).isNotNull();
assertThat(storedExisting.getName()).isEqualTo("newName");
}
use of io.lumeer.api.model.User in project engine by Lumeer.
the class UserFacadeIT method testUpdateGroups.
@Test
public void testUpdateGroups() {
String userId = createUser(organizationId1, USER1).getId();
Set<String> newGroups = new HashSet<>(Arrays.asList("g1", "g2"));
User toUpdate = prepareUser(organizationId1, USER1);
toUpdate.setGroups(Collections.singletonMap(organizationId1, newGroups));
userFacade.updateUser(organizationId1, userId, toUpdate);
User stored = getUser(organizationId1, USER1);
assertThat(stored).isNotNull();
assertThat(stored.getName()).isEqualTo(USER1);
assertThat(stored.getGroups().get(organizationId1)).isEqualTo(newGroups);
}
use of io.lumeer.api.model.User in project engine by Lumeer.
the class UserFacadeIT method testCreateUser.
@Test
public void testCreateUser() {
userFacade.createUser(organizationId1, prepareUser(organizationId1, USER1));
User stored = getUser(organizationId1, USER1);
assertThat(stored).isNotNull();
assertThat(stored.getName()).isEqualTo(USER1);
assertThat(stored.getEmail()).isEqualTo(USER1);
assertThat(stored.getGroups().get(organizationId1)).isEqualTo(GROUPS);
}
use of io.lumeer.api.model.User in project engine by Lumeer.
the class UserFacadeIT method prepareUser.
private User prepareUser(String organizationId, String user) {
User u = new User(user);
u.setName(user);
u.setGroups(Collections.singletonMap(organizationId, GROUPS));
return u;
}
use of io.lumeer.api.model.User in project engine by Lumeer.
the class CollectionServiceIT 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);
collectionDao.setProject(storedProject);
collectionDao.createCollectionsRepository(project);
}
Aggregations