예제 #1
0
  /**
   * @throws SDataException
   * @throws RepositoryException
   */
  public CHSNodeMap(ContentEntity n, int depth, ResourceDefinition rp) throws SDataException {
    String lock = ContentHostingService.AUTH_RESOURCE_HIDDEN;
    sessionManager = Kernel.sessionManager();
    entityManager = Kernel.entityManager();
    String userId = sessionManager.getCurrentSessionUserId();
    String reference = n.getReference();
    Reference referenceObj = entityManager.newReference(reference);
    Collection<?> groups = referenceObj.getAuthzGroups();

    boolean canSeeHidden = Kernel.securityService().unlock(userId, lock, reference, groups);

    if (!canSeeHidden && !n.isAvailable()) {
      throw new SDataAccessException(403, "Permission denied on item");
    }
    contentHostingService = Kernel.contentHostingService();
    authZGroupService = Kernel.authzGroupService();
    depth--;
    put("mixinNodeType", getMixinTypes(n));
    put("properties", getProperties(n));
    put("name", getName(n));
    if (rp != null) {
      put("path", rp.getExternalPath(n.getId()));
    }
    put("permissions", getPermissions(n));

    if (n instanceof ContentResource) {
      put("primaryNodeType", "nt:file");
      addFile((ContentResource) n);
    } else {
      put("primaryNodeType", "nt:folder");
      addFolder((ContentCollection) n, rp, depth);
    }
  }
 public MyRecentChangesHandler() {
   observer = new MyRecentChangesObserver();
   eventTrackingService = Kernel.eventTrackingService();
   eventTrackingService.addLocalObserver(observer);
 }