jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bae...@apache.org
Subject svn commit: r1454615 [1/2] - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/ oak-jcr/ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/ oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/
Date Fri, 08 Mar 2013 22:54:16 GMT
Author: baedke
Date: Fri Mar  8 22:54:15 2013
New Revision: 1454615

URL: http://svn.apache.org/r1454615
Log:
OAK-414: added tests

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizableImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImporter.java
    jackrabbit/oak/trunk/oak-jcr/pom.xml
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/SessionImporter.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizableImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizableImpl.java?rev=1454615&r1=1454614&r2=1454615&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizableImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizableImpl.java
Fri Mar  8 22:54:15 2013
@@ -66,9 +66,7 @@ abstract class AuthorizableImpl implemen
         } else {
             String msg = "Authorizable without principal name " + id;
             log.warn(msg);
-            //FIXME OAK-414 UserImport needs this workaround
-            //throw new RepositoryException(msg);
-            principalName = id;
+            throw new RepositoryException(msg);
         }
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImporter.java?rev=1454615&r1=1454614&r2=1454615&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImporter.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImporter.java
Fri Mar  8 22:54:15 2013
@@ -219,13 +219,16 @@ public class UserImporter implements Pro
     public boolean handlePropInfo(Tree parent, PropInfo propInfo, PropertyDefinition def)
throws RepositoryException {
         checkInitialized();
 
-        Authorizable a = userManager.getAuthorizable(parent);
-        if (a == null) {
+        //TODO remove hack that processes principal name first
+        String propName = propInfo.getName();
+        Authorizable a = null;
+        try {
+            a = userManager.getAuthorizable(parent);
+        } catch (RepositoryException ignore) {}
+        if (a == null && !REP_PRINCIPAL_NAME.equals(propName)) {
             log.warn("Cannot handle protected PropInfo " + propInfo + ". Node " + parent
+ " doesn't represent a valid Authorizable.");
             return false;
         }
-
-        String propName = propInfo.getName();
         if (REP_PRINCIPAL_NAME.equals(propName)) {
             if (!isValid(def, NT_REP_AUTHORIZABLE, false)) {
                 return false;
@@ -240,6 +243,11 @@ public class UserImporter implements Pro
             In case of a NEW user the actions are executed if the password
             has been imported before.
             */
+            a = userManager.getAuthorizable(parent);
+            if (a == null) {
+                log.warn("Cannot handle protected PropInfo " + propInfo + ". Node " + parent
+ " doesn't represent a valid Authorizable.");
+                return false;
+            }
             if (parent.getStatus() == Tree.Status.NEW) {
                 if (a.isGroup()) {
                     userManager.onCreate((Group) a);

Modified: jackrabbit/oak/trunk/oak-jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/pom.xml?rev=1454615&r1=1454614&r2=1454615&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-jcr/pom.xml Fri Mar  8 22:54:15 2013
@@ -249,6 +249,13 @@
       org.apache.jackrabbit.oak.jcr.security.user.GroupTest#testCyclicGroups2           
                   <!-- OAK-615 -->
       org.apache.jackrabbit.oak.jcr.security.authorization.AccessControlImporterTest#testImportACLRemoveACE
<!-- OAK-414 -->
       org.apache.jackrabbit.oak.jcr.security.authorization.AccessControlImporterTest#testImportACLUnknown
  <!-- OAK-414 -->
+      org.apache.jackrabbit.oak.jcr.security.user.UserImportTest#testImportGroupIntoUsersTree
              <!-- OAK-414 -->
+      org.apache.jackrabbit.oak.jcr.security.user.UserImportTest#testExistingPrincipal  
                   <!-- OAK-414 -->
+      org.apache.jackrabbit.oak.jcr.security.user.UserImportTest#testConflictingPrincipalsWithinImport
     <!-- OAK-414 -->
+      org.apache.jackrabbit.oak.jcr.security.user.UserImportTest#testMultiValuedPrincipalName
              <!-- OAK-414 -->
+      org.apache.jackrabbit.oak.jcr.security.user.UserImportTest#testMultiValuedPassword
                   <!-- OAK-414 -->
+      org.apache.jackrabbit.oak.jcr.security.user.UserImportTest#testIncompleteUser     
                   <!-- OAK-414 -->
+      org.apache.jackrabbit.oak.jcr.security.user.UserImportTest#testImportImpersonation
                   <!-- OAK-414 -->
       org.apache.jackrabbit.oak.jcr.version.VersionHistoryTest#testGetVersionHistoryFromNode
            <!-- OAK-601 -->
       org.apache.jackrabbit.oak.jcr.version.VersionHistoryTest#testGetVersionHistory    
                <!-- OAK-602 -->
       org.apache.jackrabbit.oak.jcr.version.VersionHistoryTest#testGetVersionHistoryAfterMove
           <!-- OAK-602 -->

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/SessionImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/SessionImporter.java?rev=1454615&r1=1454614&r2=1454615&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/SessionImporter.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/xml/SessionImporter.java
Fri Mar  8 22:54:15 2013
@@ -420,6 +420,18 @@ public class SessionImporter implements 
 
         // process properties
 
+        //TODO remove hack that processes principal name first
+        int principalNameIndex = -1;
+        for (int k = 0; k < propInfos.size(); k++) {
+            PropInfo propInfo = propInfos.get(k);
+            if ("rep:principalName".equals(propInfo.getName())) {
+                principalNameIndex = k;
+                break;
+            }
+        }
+        if (principalNameIndex >= 0) {
+            propInfos.add(0, propInfos.remove(principalNameIndex));
+        }
         for (PropInfo pi : propInfos) {
             // find applicable definition
             //TODO find a proper way to get the EffectiveNodeTypeProvider



Mime
View raw message