Example #1
0
  @Test
  public void addUserAdminToGroup() {
    User user = getUser(UserRole.ROLE_ORG_USER, UserRole.ROLE_GROUP_USER);

    Organization newOrganization = new Organization();
    newOrganization.setName("New Organization");
    organizationService.add(newOrganization);

    Group group = new Group();
    group.setAccessCode(UUID.randomUUID().toString());
    group.setName("New Group");
    group.setOrganization(newOrganization);
    groupService.save(group);
    groupService.getAll();

    GroupUserRequest groupUserRequest =
        requestService.createGroupUserRequest(user, group.getAccessCode());
    requestService.getAll(group.getId());

    boolean isAdded =
        userService.addUserToGroup(
            groupUserRequest.getUser(),
            groupUserRequest.getGroup().getId(),
            UserRole.ROLE_GROUP_ADMIN);
    assertTrue(isAdded);
  }
Example #2
0
  private Organization createOrganization() {
    Organization organization = new Organization();
    organization.setAccessCode(UUID.randomUUID().toString());
    organization.setName("Test Organization 2");
    organization.setDomainConfiguration(new DomainConfiguration());
    organization.getCategories().add(createCategory(organization));
    organizationService.add(organization);

    return organization;
  }
Example #3
0
  @Test
  public void addUserToOrganizationTest() {
    User user = getUser(UserRole.ROLE_ORG_USER, UserRole.ROLE_GROUP_USER);

    Organization newOrganization = new Organization();
    newOrganization.setName("New Organization");
    organizationService.add(newOrganization);

    organizationService.getAll();

    userService.addUserToOrganization(user, newOrganization.getId(), UserRole.ROLE_ORG_USER);
    List<Organization> organizations = userService.getOrganizations(user);
    assertTrue(organizations.size() == 2);
    assertTrue(userService.isUserInOrganization(user, newOrganization, UserRole.ROLE_ORG_USER));
  }