jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1511352 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImporter.java
Date Wed, 07 Aug 2013 15:10:00 GMT
Author: mduerig
Date: Wed Aug  7 15:09:59 2013
New Revision: 1511352

URL: http://svn.apache.org/r1511352
Log:
OAK-945: UserImporter should not cast UserManager to UserManagerImpl
correct handling of UserManager autosave

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImporter.java

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=1511352&r1=1511351&r2=1511352&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
Wed Aug  7 15:09:59 2013
@@ -179,12 +179,32 @@ class UserImporter implements ProtectedP
             return false;
         }
 
+        if (!initUserManager(isWorkspaceImport, securityProvider)) {
+            return false;
+        }
+
         userManager = new UserManagerImpl(root, namePathMapper, securityProvider);
 
         initialized = true;
         return initialized;
     }
 
+    private boolean initUserManager(boolean isWorkspaceImport, SecurityProvider securityProvider)
{
+        try {
+            if (!isWorkspaceImport && session.getUserManager().isAutoSave()) {
+                log.warn("Session import cannot handle user content: UserManager is in autosave
mode.");
+                return false;
+            }
+        } catch (RepositoryException e) {
+            // failed to access user manager or to set the autosave behavior
+            // -> return false (not initialized) as importer can't operate.
+            log.error("Failed to initialize UserImporter: ", e);
+            return false;
+        }
+
+        userManager = new UserManagerImpl(root, namePathMapper, securityProvider);
+        return true;
+    }
     // -----------------------------------------< ProtectedPropertyImporter >---
     @Override
     public boolean handlePropInfo(Tree parent, PropInfo propInfo, PropertyDefinition def)
throws RepositoryException {



Mime
View raw message