Package com.google.enterprise.connector.filenet4

Examples of com.google.enterprise.connector.filenet4.FileDeletionObject


    testUserAccess(AccessType.ALLOW, VIEW_ACCESS_RIGHTS,
        user.get_DistinguishedName(), user, true);
  }

  public void testInvalidUser() {
    IUser invalidUser = MockUtil.createBlankUser();
    testUserAccess(AccessType.ALLOW, VIEW_ACCESS_RIGHTS, user.get_Name(),
        invalidUser, false);
  }
View Full Code Here


  public void testUserGroupAccess_WithShortName() {
    Group everyone = MockUtil.createEveryoneGroup();
    assertEquals(everyone.get_ShortName(), "everyone");

    IUser jsmith = MockUtil.createUserWithShortName("jsmith");
    assertTrue(jsmith.getGroupNames().contains(everyone.get_Name()));

    testGroupAccess(AccessType.ALLOW, VIEW_ACCESS_RIGHTS,
        everyone.get_ShortName(), jsmith, false);
  }
View Full Code Here

  public void testUserGroupAccess_WithDistinguishedName() {
    Group everyone = MockUtil.createEveryoneGroup();
    assertEquals(everyone.get_DistinguishedName(),
        MockUtil.getDistinguishedName("everyone@" + TestConnection.domain));

    IUser jsmith = MockUtil.createUserWithShortName("jsmith");
    assertTrue(jsmith.getGroupNames().contains(everyone.get_Name()));

    testGroupAccess(AccessType.ALLOW, VIEW_ACCESS_RIGHTS,
        everyone.get_DistinguishedName(), jsmith, true);
  }
View Full Code Here

    return AccessLevel.FULL_CONTROL_AS_INT & ~allowRights;
  }

  private void testUserMarking(AccessType accessType, int accessMask,
      boolean expectedResult, AccessRight... allowRights) {
    IUser user1 = MockUtil.createUserWithDomain("user1", "foo.example.com");
    testMarking(accessType, accessMask, SecurityPrincipalType.USER,
        user1.get_Name(), user1, expectedResult, allowRights);
  }
View Full Code Here

    testUserMarking(AccessType.DENY, AccessRight.USE_MARKING_AS_INT, false,
        AccessRight.READ);
  }

  public void testMarking_NoUseRight_ViewLevelConstraint() {
    IUser user1 = MockUtil.createUserWithDomain("user1", "foo.example.com");
    testMarking(AccessType.ALLOW, AccessRight.NONE_AS_INT,
        SecurityPrincipalType.USER, user1.get_Name(), user1, true,
        constraintMask(AccessLevel.VIEW_AS_INT));
    testMarking(AccessType.DENY, AccessRight.NONE_AS_INT,
        SecurityPrincipalType.USER, user1.get_Name(), user1, true,
        constraintMask(AccessLevel.VIEW_AS_INT));
  }
View Full Code Here

    testUserMarking(AccessType.DENY, AccessRight.NONE_AS_INT, false,
        AccessRight.DELETE, AccessRight.WRITE, AccessRight.WRITE_ACL);
  }

  public void testMarking_NoUseRight_HavingBothAllowAndDeny() {
    IUser user1 = MockUtil.createUserWithDomain("user1", "foo.example.com");

    AccessPermissionMock perm1 =
        new AccessPermissionMock(PermissionSource.SOURCE_DIRECT);
    perm1.set_AccessType(AccessType.ALLOW);
    perm1.set_AccessMask(AccessRight.NONE_AS_INT);
    perm1.set_GranteeType(SecurityPrincipalType.USER);
    perm1.set_GranteeName(user1.get_Name());
    perms.add(perm1);

    // The access mask can be set to any value for DENY as it does not have any
    // effects.
    AccessPermissionMock perm2 =
        new AccessPermissionMock(PermissionSource.SOURCE_DIRECT);
    perm2.set_AccessType(AccessType.DENY);
    perm2.set_AccessMask(VIEW_ACCESS_RIGHTS);
    perm2.set_GranteeType(SecurityPrincipalType.USER);
    perm2.set_GranteeName(user1.get_Name());
    perms.add(perm2);

    Permissions testPerms = new Permissions(perms);
    assertEquals(true, testPerms.authorizeMarking(user1,
        constraintMask(AccessRight.VIEW_CONTENT, AccessRight.READ)));
View Full Code Here

    assertEquals(true, testPerms.authorizeMarking(user1,
        constraintMask(AccessRight.VIEW_CONTENT, AccessRight.READ)));
  }

  public void testMarking_HavingBothAllowAndDenyUseRights() {
    IUser user1 = MockUtil.createUserWithDomain("user1", "foo.example.com");

    AccessPermissionMock allowUse =
        new AccessPermissionMock(PermissionSource.SOURCE_DIRECT);
    allowUse.set_AccessType(AccessType.ALLOW);
    allowUse.set_AccessMask(AccessRight.USE_MARKING_AS_INT);
    allowUse.set_GranteeType(SecurityPrincipalType.USER);
    allowUse.set_GranteeName(user1.get_Name());
    perms.add(allowUse);

    AccessPermissionMock denyUse =
        new AccessPermissionMock(PermissionSource.SOURCE_DIRECT);
    denyUse.set_AccessType(AccessType.DENY);
    denyUse.set_AccessMask(AccessRight.USE_MARKING_AS_INT);
    denyUse.set_GranteeType(SecurityPrincipalType.USER);
    denyUse.set_GranteeName(user1.get_Name());
    perms.add(denyUse);

    Permissions testPerms = new Permissions(perms);
    assertEquals(false, testPerms.authorizeMarking(user1,
        constraintMask(AccessRight.NONE_AS_INT)));
View Full Code Here

    assertEquals(true, testPerms.authorizeMarking(user1,
        constraintMask(AccessRight.VIEW_CONTENT, AccessRight.READ)));
  }

  public void testMarking_UserNotMatchingAnyAces() {
    IUser user1 = MockUtil.createUserWithDomain("user1", "foo.example.com");
    testMarking(AccessType.ALLOW, VIEW_ACCESS_RIGHTS,
        SecurityPrincipalType.USER, "user2@bar.example.com", user1, true,
        AccessRight.READ, AccessRight.VIEW_CONTENT);
    testMarking(AccessType.ALLOW, VIEW_ACCESS_RIGHTS,
        SecurityPrincipalType.USER, "user2@bar.example.com", user1, false,
View Full Code Here

  }

  @Override
  public IUser getUser(AuthenticationIdentity id) {
    // Lookup FileNet user and user's groups
    IUserContext uc = conn.getUserContext();
    String username = FileUtil.getUserName(id);
    try {
      return uc.lookupUser(username);
    } catch (RepositoryException e) {
      logger.log(Level.WARNING, "Failed to lookup user [" + username
          + "] in FileNet", e);
      return null;
    }
View Full Code Here

   * @param authenticationIdentity: contains user credentials
   * */
  @Override
  public AuthenticationResponse authenticate(AuthenticationIdentity id)
      throws RepositoryException {
    IUserContext uc = conn.getUserContext();
    String username = FileUtil.getUserName(id);
    try {
      IUser user = uc.authenticate(username, id.getPassword());
      List<Principal> principalGroups = FileUtil.getPrincipals(
          PrincipalType.UNKNOWN, globalNamespace, user.getGroupNames(),
          CaseSensitivityType.EVERYTHING_CASE_INSENSITIVE);
      return new AuthenticationResponse(true, "", principalGroups);
    } catch (Throwable e) {
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.filenet4.FileDeletionObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.