]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/security/SecurityJcrUtils.java
Change profile and user home
[lgpl/argeo-commons.git] / server / runtime / org.argeo.server.jcr / src / main / java / org / argeo / jcr / security / SecurityJcrUtils.java
index abf4347db4bc930ab24e2c53853415471d5b3c4c..90a8d87bdd124d08d2e9fa1e89fd7734dfde07f3 100644 (file)
@@ -7,18 +7,19 @@ import javax.jcr.version.VersionManager;
 
 import org.argeo.ArgeoException;
 import org.argeo.jcr.ArgeoJcrConstants;
-import org.argeo.jcr.ArgeoJcrUtils;
 import org.argeo.jcr.ArgeoNames;
 import org.argeo.jcr.ArgeoTypes;
 import org.argeo.jcr.JcrUtils;
+import org.argeo.jcr.UserJcrUtils;
 
 /** Utilities related to Argeo security model in JCR */
+@Deprecated
 public class SecurityJcrUtils implements ArgeoJcrConstants {
        /**
         * Creates an Argeo user home, does nothing if it already exists. Session is
         * NOT saved.
         */
-       public static Node createUserHomeIfNeeded(Session session, String username) {
+       static Node createUserHomeIfNeeded(Session session, String username) {
                try {
                        String homePath = generateUserHomePath(username);
                        if (session.itemExists(homePath))
@@ -27,8 +28,9 @@ public class SecurityJcrUtils implements ArgeoJcrConstants {
                                Node userHome = JcrUtils.mkdirs(session, homePath);
                                userHome.addMixin(ArgeoTypes.ARGEO_USER_HOME);
                                userHome.setProperty(ArgeoNames.ARGEO_USER_ID, username);
-                               
-                               //JcrUtils.addPrivilege(session, homePath, username, "jcr:all");
+
+                               // JcrUtils.addPrivilege(session, homePath, username,
+                               // "jcr:all");
                                return userHome;
                        }
                } catch (RepositoryException e) {
@@ -39,7 +41,7 @@ public class SecurityJcrUtils implements ArgeoJcrConstants {
        }
 
        private static String generateUserHomePath(String username) {
-               String homeBasePath = DEFAULT_HOME_BASE_PATH;
+               String homeBasePath = UserJcrUtils.DEFAULT_HOME_BASE_PATH;
                return homeBasePath + '/' + JcrUtils.firstCharsToPath(username, 2)
                                + '/' + username;
        }
@@ -50,7 +52,7 @@ public class SecurityJcrUtils implements ArgeoJcrConstants {
         * is not saved and the node is in a checkedOut state (that is, it requires
         * a subsequent checkin after saving the session).
         */
-       public static Node createUserProfile(Session session, String username) {
+       static Node createUserProfile(Session session, String username) {
                try {
                        Node userHome = createUserHomeIfNeeded(session, username);
                        if (userHome.hasNode(ArgeoNames.ARGEO_PROFILE))
@@ -78,7 +80,7 @@ public class SecurityJcrUtils implements ArgeoJcrConstants {
         * 
         * @return the user profile
         */
-       public static Node createUserProfileIfNeeded(Session securitySession,
+       static Node createUserProfileIfNeeded(Session securitySession,
                        String username) {
                try {
                        Node userHome = createUserHomeIfNeeded(securitySession, username);
@@ -103,9 +105,9 @@ public class SecurityJcrUtils implements ArgeoJcrConstants {
        /**
         * @return null if not found *
         */
-       public static Node getUserProfile(Session session, String username) {
+       static Node getUserProfile(Session session, String username) {
                try {
-                       Node userHome = ArgeoJcrUtils.getUserHome(session, username);
+                       Node userHome = UserJcrUtils.getUserHome(session, username);
                        if (userHome == null)
                                return null;
                        if (userHome.hasNode(ArgeoNames.ARGEO_PROFILE))