Package org.exoplatform.services.jcr.access

Examples of org.exoplatform.services.jcr.access.AccessControlList


      for (AccessControlEntry aEntry : nodeData().getACL().getPermissionEntries())
      {
         listEntry.add(new AccessControlEntry(aEntry.getIdentity(), aEntry.getPermission()));
      }

      return new AccessControlList(nodeData().getACL().getOwner(), listEntry);
   }
View Full Code Here


         throw new AccessControlException("Node is not exo:privilegeable " + getPath());
      }

      checkPermission(PermissionType.CHANGE_PERMISSION);

      AccessControlList acl = new AccessControlList(getACL().getOwner(), getACL().getPermissionEntries());
      acl.removePermissions(identity);
      setACL(acl);
      updatePermissions(acl);
   }
View Full Code Here

         throw new AccessControlException("Node is not exo:privilegeable " + getPath());
      }

      checkPermission(PermissionType.CHANGE_PERMISSION);

      AccessControlList acl = new AccessControlList(getACL().getOwner(), getACL().getPermissionEntries());
      acl.removePermissions(identity, permission);
      setACL(acl);
      updatePermissions(acl);
   }
View Full Code Here

         throw new RepositoryException("Permission cannot be null");
      }

      // check if changing permission allowed
      checkPermission(PermissionType.CHANGE_PERMISSION);
      AccessControlList acl = new AccessControlList(getACL().getOwner(), getACL().getPermissionEntries());
      acl.removePermissions(identity);
      acl.addPermissions(identity, permission);
      setACL(acl);
      updatePermissions(acl);
   }
View Full Code Here

            AccessControlEntry ace = new AccessControlEntry(identity, perm[j]);
            aces.add(ace);
         }
      }

      AccessControlList acl = new AccessControlList(getACL().getOwner(), aces);
      setACL(acl);
      updatePermissions(acl);
   }
View Full Code Here

      int orderNum = parentNode.getNextChildOrderNum();
      int index = parentNode.getNextChildIndex(name, parentNode.nodeData());

      QPath path = QPath.makeChildPath(parentNode.getInternalPath(), name, index);

      AccessControlList acl = parentNode.getACL();

      // create new nodedata, [PN] fix of use index as persisted version
      NodeData nodeData =
         new TransientNodeData(path, identifier, -1, primaryTypeName, mixinTypeNames, orderNum,
            parentNode.getInternalIdentifier(), acl);
View Full Code Here

         mixinTypes = "Error requesting mixin types";
      }
      // get ACL
      try
      {
         AccessControlList list = getACL();
         acl = list == null ? "-;" : list.dump();
         acl = acl.replaceAll("\\n", "; ");
      }
      catch (RepositoryException e)
      {
         acl = "Error requesting ACL";
View Full Code Here

            }
            // going up to the root
            parent = (NodeData)getItemData(parent.getParentIdentifier());
         }
      }
      return new AccessControlList();
   }
View Full Code Here

    */
   private ItemData initACL(NodeData parent, NodeData node) throws RepositoryException
   {
      if (node != null)
      {
         AccessControlList acl = node.getACL();
         if (acl == null)
         {
            if (parent != null)
            {
               // use parent ACL
               node =
                  new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(), node
                     .getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(),
                     node.getParentIdentifier(), parent.getACL());
            }
            else
            {
               // use nearest ancestor ACL... case of get by id
               node =
                  new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(), node
                     .getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(),
                     node.getParentIdentifier(), getNearestACAncestorAcl(node));
            }
         }
         else if (!acl.hasPermissions())
         {
            // use nearest ancestor permissions
            AccessControlList ancestorAcl = getNearestACAncestorAcl(node);

            node =
               new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(), node
                  .getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(), node.getParentIdentifier(),
                  new AccessControlList(acl.getOwner(), ancestorAcl.getPermissionEntries()));
         }
         else if (!acl.hasOwner())
         {
            // use nearest ancestor owner
            AccessControlList ancestorAcl = getNearestACAncestorAcl(node);

            node =
               new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(), node
                  .getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(), node.getParentIdentifier(),
                  new AccessControlList(ancestorAcl.getOwner(), acl.getPermissionEntries()));

         }
      }

      return node;
View Full Code Here

      long start = System.currentTimeMillis();

      if (addACL)
      {
         AccessControlList acl = new AccessControlList();
         InternalQName[] mixins = new InternalQName[]{Constants.EXO_OWNEABLE, Constants.EXO_PRIVILEGEABLE};

         jcrNodetypes =
            TransientNodeData.createNodeData(nsSystem, Constants.JCR_NODETYPES, Constants.NT_UNSTRUCTURED, mixins,
               Constants.NODETYPESROOT_UUID);

         TransientPropertyData primaryType =
            TransientPropertyData.createPropertyData(jcrNodetypes, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
               new TransientValueData(jcrNodetypes.getPrimaryTypeName()));

         changesLog.add(ItemState.createAddedState(jcrNodetypes)).add(ItemState.createAddedState(primaryType));

         // jcr:mixinTypes
         List<ValueData> mixValues = new ArrayList<ValueData>();
         for (InternalQName mixin : mixins)
         {
            mixValues.add(new TransientValueData(mixin));
         }
         TransientPropertyData exoMixinTypes =
            TransientPropertyData.createPropertyData(jcrNodetypes, Constants.JCR_MIXINTYPES, PropertyType.NAME, true,
               mixValues);

         TransientPropertyData exoOwner =
            TransientPropertyData.createPropertyData(jcrNodetypes, Constants.EXO_OWNER, PropertyType.STRING, false,
               new TransientValueData(acl.getOwner()));

         List<ValueData> permsValues = new ArrayList<ValueData>();
         for (int i = 0; i < acl.getPermissionEntries().size(); i++)
         {
            AccessControlEntry entry = acl.getPermissionEntries().get(i);
            permsValues.add(new TransientValueData(entry));
         }
         TransientPropertyData exoPerms =
            TransientPropertyData.createPropertyData(jcrNodetypes, Constants.EXO_PERMISSIONS,
               ExtendedPropertyType.PERMISSION, true, permsValues);
View Full Code Here

TOP

Related Classes of org.exoplatform.services.jcr.access.AccessControlList

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.