Keep working on authorisations.
[gpl/argeo-suite.git] / org.argeo.suite.core / src / org / argeo / suite / core / SuiteMaintenanceService.java
index 44d218c4764d89ec1c935993e5c2abc4059c2152..66cabc4922ad92335896b805625ac7973c28f070 100644 (file)
@@ -5,10 +5,14 @@ import java.io.IOException;
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.security.Privilege;
 
-import org.argeo.entity.EntityNames;
+import org.argeo.api.NodeConstants;
 import org.argeo.entity.EntityType;
+import org.argeo.jcr.JcrUtils;
 import org.argeo.maintenance.AbstractMaintenanceService;
+import org.argeo.suite.SuiteRole;
 
 /** Initialises an Argeo Suite backend. */
 public class SuiteMaintenanceService extends AbstractMaintenanceService {
@@ -17,8 +21,8 @@ public class SuiteMaintenanceService extends AbstractMaintenanceService {
        public boolean prepareJcrTree(Session adminSession) throws RepositoryException, IOException {
                boolean modified = false;
                Node rootNode = adminSession.getRootNode();
-               if (!rootNode.hasNode(EntityNames.TERM_BASE)) {
-                       rootNode.addNode(EntityNames.TERM_BASE, EntityType.typologies.get());
+               if (!rootNode.hasNode(EntityType.user.name())) {
+                       rootNode.addNode(EntityType.user.name(), NodeType.NT_UNSTRUCTURED);
                        modified = true;
                }
                if (modified)
@@ -26,4 +30,11 @@ public class SuiteMaintenanceService extends AbstractMaintenanceService {
                return modified;
        }
 
+       @Override
+       public void configurePrivileges(Session adminSession) throws RepositoryException {
+               JcrUtils.addPrivilege(adminSession, EntityType.user.basePath(), NodeConstants.ROLE_USER_ADMIN,
+                               Privilege.JCR_ALL);
+               //JcrUtils.addPrivilege(adminSession, "/", SuiteRole.coworker.dn(), Privilege.JCR_READ);
+       }
+
 }