[exo-jcr-commits] exo-jcr SVN: r2961 - in jcr/branches/1.12.x/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration and 1 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Aug 20 08:57:12 EDT 2010


Author: tolusha
Date: 2010-08-20 08:57:11 -0400 (Fri, 20 Aug 2010)
New Revision: 2961

Added:
   jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestRemoveNodeTypeNode.java
Modified:
   jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java
   jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java
   jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java
Log:
EXOJCR-898: fixes for Incorrect jcr:system node's permission initialization in ScratchWorkspaceInitializer

Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java	2010-08-20 12:51:08 UTC (rev 2960)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java	2010-08-20 12:57:11 UTC (rev 2961)
@@ -347,12 +347,13 @@
 
       if (addACL)
       {
-         AccessControlList acl = new AccessControlList();
          InternalQName[] mixins = new InternalQName[]{Constants.EXO_OWNEABLE, Constants.EXO_PRIVILEGEABLE};
 
          exoNamespaces =
             TransientNodeData.createNodeData(nsSystem, Constants.EXO_NAMESPACES, Constants.NT_UNSTRUCTURED, mixins);
 
+         AccessControlList acl = exoNamespaces.getACL();
+
          TransientPropertyData primaryType =
             TransientPropertyData.createPropertyData(exoNamespaces, Constants.JCR_PRIMARYTYPE, PropertyType.NAME,
                false, new TransientValueData(exoNamespaces.getPrimaryTypeName()));

Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java	2010-08-20 12:51:08 UTC (rev 2960)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java	2010-08-20 12:57:11 UTC (rev 2961)
@@ -139,9 +139,6 @@
             : Constants.NT_UNSTRUCTURED;
 
       this.dataManager = dataManager;
-      // this.nsPersister = nsPersister;
-      // this.ntRegistry = ntRegistry;
-
    }
 
    public NodeData initWorkspace() throws RepositoryException
@@ -273,13 +270,14 @@
 
       if (addACL)
       {
-         AccessControlList acl = new AccessControlList();
          InternalQName[] mixins = new InternalQName[]{Constants.EXO_OWNEABLE, Constants.EXO_PRIVILEGEABLE};
 
          jcrSystem =
             TransientNodeData.createNodeData(root, Constants.JCR_SYSTEM, Constants.NT_UNSTRUCTURED, mixins,
                Constants.SYSTEM_UUID);
 
+         AccessControlList acl = jcrSystem.getACL();
+
          TransientPropertyData primaryType =
             TransientPropertyData.createPropertyData(jcrSystem, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
                new TransientValueData(jcrSystem.getPrimaryTypeName()));
@@ -340,15 +338,6 @@
 
       dataManager.save(new TransactionChangesLog(changesLog));
 
-      //nsPersister.initStorage(jcrSystem, addACL, NamespaceRegistryImpl.DEF_NAMESPACES);
-      // nodeTypes save
-      // changesLog = new PlainChangesLogImpl();
-      // changesLog.addAll(ntPersister.initNodetypesRoot(jcrSystem,
-      // addACL).getAllStates());
-      // changesLog.addAll(ntPersister.initStorage(nodeTypeDataManager.getAllNodeTypes()).getAllStates());
-      // ntPersister.saveChanges(changesLog);
-
-      // nodeTypeDataManager.initDefaultNodeTypes(addACL);
       return jcrSystem;
    }
 

Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java	2010-08-20 12:51:08 UTC (rev 2960)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java	2010-08-20 12:57:11 UTC (rev 2961)
@@ -153,13 +153,14 @@
 
       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);
 
+         AccessControlList acl = jcrNodetypes.getACL();
+
          TransientPropertyData primaryType =
             TransientPropertyData.createPropertyData(jcrNodetypes, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
                new TransientValueData(jcrNodetypes.getPrimaryTypeName()));

Added: jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestRemoveNodeTypeNode.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestRemoveNodeTypeNode.java	                        (rev 0)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestRemoveNodeTypeNode.java	2010-08-20 12:57:11 UTC (rev 2961)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.impl.access;
+
+import org.exoplatform.services.jcr.BaseStandaloneTest;
+import org.exoplatform.services.jcr.core.CredentialsImpl;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.Credentials;
+import javax.jcr.Node;
+import javax.jcr.Repository;
+import javax.jcr.Session;
+
+/**
+ * @author <a href="anatoliy.bazko at exoplatform.org">Anatoliy Bazko</a>
+ * @version $Id: TestRemoveSysteNode.java 111 2010-11-11 11:11:11Z tolusha $
+ * 
+ */
+public class TestRemoveNodeTypeNode extends BaseStandaloneTest {
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  protected String getRepositoryName() {
+    return null;
+  }
+
+  public void testRemove() throws Exception {
+    Repository repository = repositoryService.getRepository("db1tck");
+    Credentials credentials = new CredentialsImpl("demo", "exo".toCharArray());
+    Session session = repository.login(credentials, "ws");
+
+    Node node = session.getRootNode()
+                       .getNode("jcr:system")
+                       .getNode("jcr:nodetypes")
+                       .getNode("nt:base");
+    try {
+      node.remove();
+      session.save();
+
+      fail("Exception should be thrown.");
+    } catch (AccessDeniedException e) {
+    }
+  }
+}



More information about the exo-jcr-commits mailing list