Check if user is anonymous
authorMathieu Baudier <mbaudier@argeo.org>
Wed, 13 Mar 2013 15:15:42 +0000 (15:15 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Wed, 13 Mar 2013 15:15:42 +0000 (15:15 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@6124 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/views/DistributionsView.java

index cbed6adac450d89998c715a0bcba9ede6f79ebd0..ed1848fc3f27b4384693a70b58eb5b7d4f246502 100644 (file)
@@ -151,10 +151,13 @@ public class DistributionsView extends ViewPart implements SlcNames, ArgeoNames
                try {
                        nodeSession = nodeRepository.login();
 
+                       Node homeNode = UserJcrUtils.getUserHome(nodeSession);
+                       if (homeNode == null) // anonymous
+                               throw new SlcException("User must be authenticated.");
+
                        // make sure base directory is available
-                       Node repos = JcrUtils.mkdirs(nodeSession,
-                                       UserJcrUtils.getUserHome(nodeSession).getPath()
-                                                       + RepoConstants.REPOSITORIES_BASE_PATH);
+                       Node repos = JcrUtils.mkdirs(nodeSession, homeNode.getPath()
+                                       + RepoConstants.REPOSITORIES_BASE_PATH);
                        nodeSession.save();
 
                        // register default local java repository
@@ -410,8 +413,8 @@ public class DistributionsView extends ViewPart implements SlcNames, ArgeoNames
 
                        return null;
                }
-       }       
-       
+       }
+
        /** Content provider */
        private class DistributionsContentProvider implements ITreeContentProvider {
                Session nodeSession;