]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/views/DistributionsView.java
Check if user is anonymous
[gpl/argeo-slc.git] / 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;