Package com.google.enterprise.connector.filenet4

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


  /*
   * Test method for
   * 'com.google.enterprise.connector.file.filejavawrap.FnConnection.getUserContext()'
   */
  public void testGetUserContext() throws RepositoryException {
    IUserContext test = conn.getUserContext();
    assertNotNull(test);
    assertEquals(TestConnection.currentUserContext, test.getName());
  }
View Full Code Here


  @Override
  public AuthorizationResponse authorizeDocid(String docId, IUser user,
      boolean checkMarkings) throws RepositoryException {
    AuthorizationResponse authorizationResponse = null;
    IVersionSeries versionSeries = null;
    try {
      logger.config("Getting version series for document DocID: "
          + docId);
      versionSeries = (IVersionSeries) objectStore.getObject(ClassNames.VERSION_SERIES, URLDecoder.decode(docId, "UTF-8"));
    } catch (UnsupportedEncodingException e) {
      logger.log(Level.WARNING, "Unable to Decode: Encoding is not supported for the document with DocID: "
          + docId);
      versionSeries = null;
    } catch (RepositoryException e) {
      logger.log(Level.WARNING, "Error : document Version Series Id "
          + docId + " may no longer exist. Message: "
          + e.getLocalizedMessage());
      versionSeries = null;
    }

    if (versionSeries != null) {
      logger.config("Authorizing DocID: " + docId + " for user: "
          + user.get_Name());
      // Check whether the search user is authorized to view document
      // contents or
      // not.
      IDocument releasedVersion = versionSeries.get_ReleasedVersion();
      Permissions permissions = new Permissions(
          releasedVersion.get_Permissions(), releasedVersion.get_Owner());
      if (permissions.authorize(user)) {
        logger.log(Level.INFO, "As per the ACLS User "
            + user.get_Name()
View Full Code Here

      assertTrue(value.getClass().getName().toUpperCase().contains(typeSet));
    }
  }

  public void testGetVersionSeries() throws RepositoryException {
    IVersionSeries vs = fd.getVersionSeries();
    assertEquals("{" + TestConnection.docVsId1 + "}", vs.get_Id().toString());
  }
View Full Code Here

    boolean authorized = perms.authorize(MockUtil.createAdministratorUser());
    assertTrue("User is not authorized", authorized);
  }

  public void testMarkingPermissions() throws RepositoryException {
    IVersionSeries versionSeries =
        (IVersionSeries) ios.getObject(ClassNames.VERSION_SERIES,
            TestConnection.docVsId1);
    IDocument doc = versionSeries.get_ReleasedVersion();
    IActiveMarkingList activeMarkingList = doc.get_ActiveMarkings();
    assertNotNull("Active marking is null", activeMarkingList);
    assertTrue(user.get_Name() + " is not authorized by document's marking",
        new MarkingPermissions(activeMarkingList).authorize(user));
  }
View Full Code Here

    return perm;
  }

  public static AccessPermissionList newPermissionList(
      List<AccessPermission>... aceLists) {
    AccessPermissionListMock perms = new AccessPermissionListMock();
    for (List<AccessPermission> aceList : aceLists) {
      perms.addAll(aceList);
    }
    return perms;
  }
View Full Code Here

  private final AccessPermissionList permissions;

  public MockBaseObject(IId id, IId versionSeriesId, Date lastModified,
     boolean isDeletionEvent, boolean releasedVersion) {
    this(id, versionSeriesId, lastModified, isDeletionEvent, releasedVersion,
        new AccessPermissionListMock());
  }
View Full Code Here

  private IUser user;
 
  @Override
  protected void setUp() throws Exception {
    super.setUp();
    perms = new AccessPermissionListMock();
    user = MockUtil.createAdministratorUser();
  }
View Full Code Here

  // TODO(tdnguyen): Combine this method with similar methods in
  // PermissionsTest.
  public static AccessPermission newPermission(String granteeName,
      SecurityPrincipalType principalType, AccessType accessType,
      int accessMask, int inheritableDepth, PermissionSource permSrc) {
    AccessPermissionMock perm = new AccessPermissionMock(permSrc);
    perm.set_GranteeType(principalType);
    perm.set_AccessType(accessType);
    perm.set_AccessMask(accessMask);
    perm.set_InheritableDepth(inheritableDepth);
    perm.set_GranteeName(granteeName);
    return perm;
  }
View Full Code Here

        false);
  }

  private void testCreatorOwnerAccess(AccessType accessType, int accessRights,
      boolean expectedResult) {
    AccessPermissionMock perm =
        new AccessPermissionMock(PermissionSource.SOURCE_DIRECT);
    perm.set_AccessType(accessType);
    perm.set_AccessMask(accessRights);
    perm.set_GranteeType(SecurityPrincipalType.USER);
    perm.set_GranteeName("#CREATOR-OWNER");
    perms.add(perm);

    Permissions testPerms = new Permissions(perms, user.get_Name());
    assertEquals(expectedResult, testPerms.authorize(user));
  }
View Full Code Here

    Permissions testPerms = new Permissions(perms, user.get_Name());
    assertEquals(expectedResult, testPerms.authorize(user));
  }

  public void testCreatorOwnerWithBothAllowAndDeny() {
    AccessPermissionMock creatorOwnerPermDeny =
        new AccessPermissionMock(PermissionSource.SOURCE_DIRECT);
    creatorOwnerPermDeny.set_AccessType(AccessType.DENY);
    creatorOwnerPermDeny.set_AccessMask(AccessRight.DELETE_AS_INT);
    creatorOwnerPermDeny.set_GranteeType(SecurityPrincipalType.USER);
    creatorOwnerPermDeny.set_GranteeName(user.get_Name());
    perms.add(creatorOwnerPermDeny);

    AccessPermissionMock creatorOwnerPermAllow =
        new AccessPermissionMock(PermissionSource.SOURCE_DIRECT);
    creatorOwnerPermAllow.set_AccessType(AccessType.ALLOW);
    creatorOwnerPermAllow.set_AccessMask(VIEW_ACCESS_RIGHTS);
    creatorOwnerPermAllow.set_GranteeType(SecurityPrincipalType.USER);
    creatorOwnerPermAllow.set_GranteeName(user.get_Name());
    perms.add(creatorOwnerPermAllow);

    Permissions testPerms = new Permissions(perms, user.get_Name());
    assertTrue(testPerms.authorize(user));
  }
View Full Code Here

TOP

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

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.