コード例 #1
0
ファイル: RemoveUserAction.java プロジェクト: piyush76/EMS
  public ActionForward executeInContext(
      UserContext uc,
      ActionMapping mapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response) {
    int uid = Integer.parseInt(request.getParameter(Constants.USER_ID_FULL));
    int custID = Integer.parseInt(request.getParameter(Constants.CUSTOMER_ID));
    IUserManager um = ManagementContainer.getInstance().getUserManager();

    UserAccount user = um.getUserAccount(custID, uid);

    if (user == null) {
      return mapping.findForward(FAILURE);
    }

    try {
      um.deleteEpaUser(user.getPrimaryEmail());
    } catch (Exception ex) {
      reportSingleError(
          request, ActionMessages.GLOBAL_MESSAGE, "error.epa.user.delete.error", ex.getMessage());
      return mapping.findForward(FAILURE);
    }

    IAuditManager auditManager = ManagementContainer.getInstance().getAuditManager();
    auditManager.saveAudit(
        IAuditManager.AuditCategory.EPA_MGMT,
        "Removed EPA user " + user.getDisplayName() + " ( " + user.getPrimaryEmail() + " )",
        "Remove EPA User Audit",
        null,
        uc.getCurrentUser().getPrimaryEmail());
    return mapping.findForward(SUCCESS);
  }
コード例 #2
0
  protected ActionForward executeInContext(
      UserContext uc,
      ActionMapping mapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response) {
    UserEmergencyContactsForm form = (UserEmergencyContactsForm) actionForm;
    IUserManager userManager = ManagementContainer.getInstance().getUserManager();
    EmergencyContactSet contactSets =
        userManager.getEmergencyContacts(uc.getCurrentUser().getUserID());
    if (contactSets != null) {
      form.populateForm(contactSets);
    }

    return mapping.findForward(SUCCESS);
  }
コード例 #3
0
ファイル: ArchiveSearchPageIT.java プロジェクト: piyush76/EMS
  @SuppressWarnings("unchecked")
  protected void setupFolderSyncZone() throws Exception {

    int custId = getJspTestUtils().getCustId();
    IFolderSyncManager folderMgr = ManagementContainer.getInstance().getFolderSyncManager();
    IUserManager userService = ManagementContainer.getInstance().getUserManager();

    UserAccount account = userService.getUser(getJspTestUtils().getUserAddress());
    m_userId = account.getUserID();

    // first create the topology and zone itself
    CustomerTopology ct = createTopology();
    Iterator serverIterator = ct.getAllServers();
    if (!serverIterator.hasNext()) {
      fail("No server in topology.");
    }
    CustomerServer server = (CustomerServer) serverIterator.next();
    Iterator storesIterator = ct.getAllStores();
    if (!storesIterator.hasNext()) {
      fail("No stores in server.");
    }
    CustomerStore store = (CustomerStore) storesIterator.next();
    FolderSyncZone zone = new FolderSyncZone();
    zone.setCustomerId(getJspTestUtils().getCustId());
    zone.setDisplayName("foobar");
    zone.setRegistrationKey("12345");
    zone.getServers().add(server);
    folderMgr.saveFolderSyncZone(zone);

    // now enable the user for folder sync
    account.setMessageStoreID(store.getStoreID());
    userService.updateUsers(Arrays.asList(account));
    SavedUserSet userSet = new SavedUserSet(custId);
    List<Integer> userIDs = Arrays.asList(account.getUserID());
    List<SearchConstraint> oldScList = new ArrayList<SearchConstraint>();
    oldScList.add(
        new SearchConstraint(
            UserManagerConstants.PROP_USERID,
            SearchConstraintOperator.CONSTRAINT_IN_LIST,
            userIDs));
    userSet.addUsers(oldScList);
    folderMgr.saveUserSetEnabledForSync(custId, userSet);
  }
コード例 #4
0
  public boolean execute(CommandLine cmdLine) {
    ICustomerManager cm = m_container.getCustomerManager();
    List<String> domains = Collections.singletonList(ICustomerManager.EPA_CUSTOMER_DOMAIN);
    IIslandManager im = m_container.getIslandManager();
    int defaultIslandID = im.getDefaultIsland().getId();

    Customer cust =
        cm.createCustomer(
            ICustomerManager.EPA_CUSTOMER_NAME,
            "System", // fromAddress
            "System", // backendID
            "System", // templateID
            "System", // channel
            domains,
            "emsRootPW", // emsRootPassword
            false, // isPartialEnabled
            "System", // activeBrandKey
            "System", // externalID
            defaultIslandID,
            defaultIslandID,
            false);

    PasswordPolicy policy = new PasswordPolicy();
    policy.setUseStrongPasswords(true);
    cust.setPasswordPolicy(policy);
    cm.updateCustomers(Collections.singletonList(cust));

    IUserManager um = ManagementContainer.getInstance().getUserManager();
    UserAccount emsRoot = um.getUser("emsroot@" + ICustomerManager.EPA_CUSTOMER_DOMAIN);
    IAuthenticationManager am = ManagementContainer.getInstance().getAuthenticationManager();
    long seconds = 31556926; // Seconds in a year
    long time =
        System.currentTimeMillis() + (seconds * 100 * 1000L); // Lock the account for 100 years
    am.lockUserAccount(
        cust.getCustID(), emsRoot.getUserID(), "Locked from user details", "Unknown", time);

    return (cust != null);
  }
コード例 #5
0
ファイル: ArchiveSearchPageIT.java プロジェクト: piyush76/EMS
  @Test
  public void verifyRetentionPolicyFilterForRetentionHolds() throws Exception {
    // Create a new Test User
    LOGGER.info("Creating a new Test user");
    String currentTime = Long.toString(System.currentTimeMillis());
    String userName = "******" + currentTime;
    String userAddress = userName + "@" + getJspTestUtils().getDomain();
    String password = getJspTestUtils().getPasswd();

    getJspTestUtils().createTestUser(userName, userAddress, password);

    int custId = getJspTestUtils().getCustId();
    LOGGER.info("Test user creation completed:" + userAddress);
    LOGGER.info("Customer Id is: " + Integer.toString(custId));

    // Get Retention policy manager, Reviewer group manager and User manager
    IRetentionPolicyManager mgr = ManagementContainer.getInstance().getRetentionPolicyManager();
    IReviewerGroupManager rgm = ManagementContainer.getInstance().getReviewerGroupManager();
    IUserManager um = ManagementContainer.getInstance().getUserManager();

    // Create Reviewer User set-1  for reviewers
    UserAccount reviewer1 = um.findUserForEmail(getJspTestUtils().m_userAddress);
    SavedUserSet sus1 = new SavedUserSet(custId);
    sus1.addUsers(
        Arrays.asList(
            new SearchConstraint(
                IUserManager.PROP_USERID,
                SearchConstraintOperator.CONSTRAINT_EQUALS,
                String.valueOf(reviewer1.getUserID()))));
    // sus1.setInternal(true);
    sus1.setName("REVIEWERS-1");
    um.saveUserSet(sus1);
    // Create User set-1 for users whose mails will be reviewed by reviewer
    SavedUserSet scope1 = InternalUserSets.getAllUsersSet(custId);
    // scope1.setInternal(true);
    scope1.setName("SCOPE-1");
    um.saveUserSet(scope1);
    // Create Reviewer group-1
    LOGGER.info("Creating Reviewer group reviewerGrp1");
    ReviewerGroup rg1 = rgm.createReviewerGroup(custId, "reviewerGrp1", sus1, scope1, null);
    rgm.updateReviewerGroup(rg1);
    rg1 = rgm.getReviewerGroup(custId, "reviewerGrp1");
    LOGGER.info(
        "Reviewer group creation done. Reviewer group details-> GroupId:"
            + rg1.getGroupID()
            + ";GroupName:"
            + rg1.getGroupName());

    RetentionPolicy qblh1 =
        TestUtils.createPolicy(
            RetentionPolicy.Mode.QUERY_BASED_LEGAL_HOLD,
            custId,
            RetentionPolicy.MAX_RETAIN,
            "QBLH-1",
            RetentionPolicy.HIGHEST_PRIORITY,
            "reviewerGrp1");
    LOGGER.info(
        "Query based legal hold QBLH-1 details-> Policy Id:"
            + qblh1.getId()
            + ";Policy Name:"
            + qblh1.getName());

    // Create Reviewer User set-2 for reviewers
    UserAccount reviewer2 = um.findUserForEmail(userAddress);
    SavedUserSet sus2 = new SavedUserSet(custId);
    sus2.addUsers(
        Arrays.asList(
            new SearchConstraint(
                IUserManager.PROP_USERID,
                SearchConstraintOperator.CONSTRAINT_EQUALS,
                String.valueOf(reviewer2.getUserID()))));
    sus2.setName("REVIEWERS-2");
    um.saveUserSet(sus2);
    // Create User set-2 for users whose mails will be reviewed by reviewer
    SavedUserSet scope2 = InternalUserSets.getAllUsersSet(custId);
    scope2.setName("SCOPE-2");
    um.saveUserSet(scope2);
    // Create Reviewer group-2
    ReviewerGroup rg2 = rgm.createReviewerGroup(custId, "reviewerGrp2", sus2, scope2, null);
    rgm.updateReviewerGroup(rg2);
    rg2 = rgm.getReviewerGroup(custId, "reviewerGrp2");
    LOGGER.info("Reviewer group details:" + rg2.getGroupID() + ";" + rg2.getGroupName());
    RetentionPolicy qblh2 =
        TestUtils.createPolicy(
            RetentionPolicy.Mode.QUERY_BASED_LEGAL_HOLD,
            custId,
            RetentionPolicy.MAX_RETAIN,
            "QBLH-2",
            RetentionPolicy.HIGHEST_PRIORITY,
            "reviewerGrp2");
    LOGGER.info(
        "Query based legal hold QBLH-2 details-> Policy Id:"
            + qblh2.getId()
            + ";Policy Name:"
            + qblh2.getName());

    // Login as reviewer-1  and verify QBLH-1 is visible to reviewer-1 and QBLH-2 is not visible
    LOGGER.info("Logging in as reviewer-1");
    getJspTestUtils()
        .login(getJspTestUtils().m_cappLoginUrl, getJspTestUtils().m_userAddress, password);
    getJspTestUtils().navigateToArchivePage();
    getJspTestUtils().clickLink(By.id("auto_common_nav_search-reviewer"));
    getJspTestUtils().clickLink(By.id("auto_add_filter"));
    getJspTestUtils()
        .clickLink(By.id("auto_filter_dialog_field-button"), By.linkText("Retention Policy"));
    getJspTestUtils().clickLink(By.id("auto_filter_dialog_value_select-button"));
    assertNotNull(
        "Query Based legal hold QBLH-1 is not present for REVIEWERS-1",
        getJspTestUtils().findElement(By.linkText("QBLH-1")));
    assertFalse(
        "Query Based legal hold QBLH-2 is present for REVIEWERS-1",
        getJspTestUtils().isElement(By.linkText("QBLH-2")));
    getJspTestUtils().logout();

    // Login as reviewer-2  and verify QBLH-2 is visible to reviewer-2 and QBLH-1 is not visible
    LOGGER.info("Logging in as reviewer-2");
    getJspTestUtils().login(getJspTestUtils().m_cappLoginUrl, userAddress, password);
    getJspTestUtils().clickLink(By.id("auto_common_nav_search-reviewer"));
    getJspTestUtils().clickLink(By.id("auto_add_filter"));
    getJspTestUtils()
        .clickLink(By.id("auto_filter_dialog_field-button"), By.linkText("Retention Policy"));
    getJspTestUtils().clickLink(By.id("auto_filter_dialog_value_select-button"));
    assertNotNull(
        "Query Based legal hold QBLH-2 is not present for REVIEWERS-2",
        getJspTestUtils().findElement(By.linkText("QBLH-2")));
    assertFalse(
        "Query Based legal hold QBLH-1 is present for REVIEWERS-2",
        getJspTestUtils().isElement(By.linkText("QBLH-1")));
    getJspTestUtils().logout();
  }