Package org.apache.jackrabbit.api.jsr283.query.qom

Examples of org.apache.jackrabbit.api.jsr283.query.qom.QueryObjectModelFactoryTest


   
    return accessMap;
  }

  private AccessControlEntry[] getDeclaredAccessControlEntries(Session session, String absPath) throws RepositoryException {
    AccessControlManager accessControlManager = AccessControlUtil.getAccessControlManager(session);
    AccessControlPolicy[] policies = accessControlManager.getPolicies(absPath);
    for (AccessControlPolicy accessControlPolicy : policies) {
      if (accessControlPolicy instanceof AccessControlList) {
        AccessControlEntry[] accessControlEntries = ((AccessControlList)accessControlPolicy).getAccessControlEntries();
        return accessControlEntries;
      }
View Full Code Here


   * @throws RepositoryException
   */
  public AccessRights getDeclaredAccessRightsForPrincipal(Session session, String absPath, String principalId) throws RepositoryException {
    AccessRights rights = new AccessRights();
    if (principalId != null && principalId.length() > 0) {
      AccessControlManager accessControlManager = AccessControlUtil.getAccessControlManager(session);
      AccessControlPolicy[] policies = accessControlManager.getPolicies(absPath);
      for (AccessControlPolicy accessControlPolicy : policies) {
        if (accessControlPolicy instanceof AccessControlList) {
          AccessControlEntry[] accessControlEntries = ((AccessControlList)accessControlPolicy).getAccessControlEntries();
          for (AccessControlEntry ace : accessControlEntries) {
            if (principalId.equals(ace.getPrincipal().getName())) {
View Full Code Here

   
    return accessMap;
  }
 
  private AccessControlEntry[] getEffectiveAccessControlEntries(Session session, String absPath) throws RepositoryException {
    AccessControlManager accessControlManager = AccessControlUtil.getAccessControlManager(session);
    AccessControlPolicy[] policies = accessControlManager.getEffectivePolicies(absPath);
    for (AccessControlPolicy accessControlPolicy : policies) {
      if (accessControlPolicy instanceof AccessControlList) {
        AccessControlEntry[] accessControlEntries = ((AccessControlList)accessControlPolicy).getAccessControlEntries();
        return accessControlEntries;
      }
View Full Code Here

   * @throws RepositoryException
   */
  public AccessRights getEffectiveAccessRightsForPrincipal(Session session, String absPath, String principalId) throws RepositoryException {
    AccessRights rights = new AccessRights();
    if (principalId != null && principalId.length() > 0) {
      AccessControlManager accessControlManager = AccessControlUtil.getAccessControlManager(session);
      AccessControlPolicy[] policies = accessControlManager.getEffectivePolicies(absPath);
      for (AccessControlPolicy accessControlPolicy : policies) {
        if (accessControlPolicy instanceof AccessControlList) {
          AccessControlEntry[] accessControlEntries = ((AccessControlList)accessControlPolicy).getAccessControlEntries();
          for (AccessControlEntry ace : accessControlEntries) {
            if (principalId.equals(ace.getPrincipal().getName())) {
View Full Code Here

   * @param absPath the path of the resource to check
   * @return true if the current user has the privileges, false otherwise
   */
  public boolean canAddChildren(Session session, String absPath) {
    try {
      AccessControlManager accessControlManager = AccessControlUtil.getAccessControlManager(session);
      return accessControlManager.hasPrivileges(absPath, new Privilege[] {
              accessControlManager.privilegeFromName(Privilege.JCR_ADD_CHILD_NODES)
            });
    } catch (RepositoryException e) {
      return false;
    }
  }
View Full Code Here

   * @param absPath the path of the resource to check
   * @return true if the current user has the privileges, false otherwise
   */
  public boolean canDeleteChildren(Session session, String absPath) {
    try {
      AccessControlManager accessControlManager = AccessControlUtil.getAccessControlManager(session);
     
      return accessControlManager.hasPrivileges(absPath, new Privilege[] {
              accessControlManager.privilegeFromName(Privilege.JCR_REMOVE_CHILD_NODES)
            });
    } catch (RepositoryException e) {
      return false;
    }
  }
View Full Code Here

   * @param absPath the path of the resource to check
   * @return true if the current user has the privileges, false otherwise
   */
  public boolean canDelete(Session session, String absPath) {
    try {
      AccessControlManager accessControlManager = AccessControlUtil.getAccessControlManager(session);
     
      String parentPath = absPath.substring(0, absPath.lastIndexOf('/'));
      boolean canDelete = accessControlManager.hasPrivileges(absPath, new Privilege[] {
              accessControlManager.privilegeFromName(Privilege.JCR_REMOVE_NODE)
            }) && canDeleteChildren(session, parentPath);
      return canDelete;
    } catch (RepositoryException e) {
      return false;
    }
View Full Code Here

   * @param absPath the path of the resource to check
   * @return true if the current user has the privileges, false otherwise
   */
  public boolean canModifyProperties(Session session, String absPath) {
    try {
      AccessControlManager accessControlManager = AccessControlUtil.getAccessControlManager(session);
      return accessControlManager.hasPrivileges(absPath, new Privilege[] {
              accessControlManager.privilegeFromName(Privilege.JCR_MODIFY_PROPERTIES)
            });
    } catch (RepositoryException e) {
      return false;
    }
  }
View Full Code Here

   * @param absPath the path of the resource to check
   * @return true if the current user has the privileges, false otherwise
   */
  public boolean canReadAccessControl(Session session, String absPath) {
    try {
      AccessControlManager accessControlManager = AccessControlUtil.getAccessControlManager(session);
      return accessControlManager.hasPrivileges(absPath, new Privilege[] {
              accessControlManager.privilegeFromName(Privilege.JCR_READ_ACCESS_CONTROL)
            });
    } catch (RepositoryException e) {
      return false;
    }
  }
View Full Code Here

   * @param absPath the path of the resource to check
   * @return true if the current user has the privileges, false otherwise
   */
  public boolean canModifyAccessControl(Session session, String absPath) {
    try {
      AccessControlManager accessControlManager = AccessControlUtil.getAccessControlManager(session);
      return accessControlManager.hasPrivileges(absPath, new Privilege[] {
              accessControlManager.privilegeFromName(Privilege.JCR_MODIFY_ACCESS_CONTROL)
            });
    } catch (RepositoryException e) {
      return false;
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.api.jsr283.query.qom.QueryObjectModelFactoryTest

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.