示例#1
0
  @Test
  public void skipAllEmailConfiguration() throws Exception {
    setup.set(PROPERTIES_SYSADMIN_APPROVES_ORGANIZATIONS, "false");
    setup.set(PROPERTIES_ORGANIZATIONS_REQUIRE_CONFIRMATION, "false");
    setup.set(PROPERTIES_SYSADMIN_APPROVES_ADMIN_USERS, "false");
    setup.set(PROPERTIES_ADMIN_USERS_REQUIRE_CONFIRMATION, "false");

    final String orgName = uniqueOrg();
    final String userName = uniqueUsername();
    final String email = uniqueEmail();

    OrganizationOwnerInfo ooi =
        setup
            .getMgmtSvc()
            .createOwnerAndOrganization(orgName, userName, "Test User", email, "testpassword");

    EntityManager em = setup.getEmf().getEntityManager(setup.getEmf().getManagementAppId());
    User user = em.get(ooi.getOwner().getUuid(), User.class);
    assertTrue(user.activated());
    assertFalse(user.disabled());
    assertTrue(user.confirmed());
  }
示例#2
0
  private User setupAppUser(UUID appId, String username, String email, boolean activated)
      throws Exception {
    Mailbox.clearAll();

    EntityManager em = setup.getEmf().getEntityManager(appId);

    Map<String, Object> userProps = new LinkedHashMap<String, Object>();
    userProps.put("username", username);
    userProps.put("email", email);
    userProps.put("activated", activated);

    User user = em.create(User.ENTITY_TYPE, User.class, userProps);
    setup.getEntityIndex().refresh(app.getId());

    return user;
  }
示例#3
0
 private void enableAdminApproval(UUID appId) throws Exception {
   EntityManager em = setup.getEmf().getEntityManager(appId);
   SimpleEntityRef ref = new SimpleEntityRef(Application.ENTITY_TYPE, appId);
   em.setProperty(ref, ManagementServiceImpl.REGISTRATION_REQUIRES_ADMIN_APPROVAL, true);
 }
示例#4
0
 private void enableEmailConfirmation(UUID appId) throws Exception {
   EntityManager em = setup.getEmf().getEntityManager(appId);
   SimpleEntityRef ref = new SimpleEntityRef(Application.ENTITY_TYPE, appId);
   em.setProperty(ref, ManagementServiceImpl.REGISTRATION_REQUIRES_EMAIL_CONFIRMATION, true);
 }