From 6a3abb7baeb17b06ab05fb9a35056e3e224698ad Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Sat, 5 Nov 2011 14:54:09 +0000 Subject: [PATCH] Improve Security git-svn-id: https://svn.argeo.org/commons/trunk@4892 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- .../security/ldap/jcr/JcrLdapSynchronizer.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/security/runtime/org.argeo.security.ldap/src/main/java/org/argeo/security/ldap/jcr/JcrLdapSynchronizer.java b/security/runtime/org.argeo.security.ldap/src/main/java/org/argeo/security/ldap/jcr/JcrLdapSynchronizer.java index 0f59f1ee5..632ea58c8 100644 --- a/security/runtime/org.argeo.security.ldap/src/main/java/org/argeo/security/ldap/jcr/JcrLdapSynchronizer.java +++ b/security/runtime/org.argeo.security.ldap/src/main/java/org/argeo/security/ldap/jcr/JcrLdapSynchronizer.java @@ -229,7 +229,7 @@ public class JcrLdapSynchronizer implements UserDetailsContextMapper, * * @return path to user profile */ - protected String mapLdapToJcr(DirContextAdapter ctx) { + protected synchronized String mapLdapToJcr(DirContextAdapter ctx) { Session session = securitySession; try { // process @@ -238,6 +238,20 @@ public class JcrLdapSynchronizer implements UserDetailsContextMapper, Node userProfile; // = userHome.getNode(ARGEO_PROFILE); if (userHome.hasNode(ARGEO_PROFILE)) { userProfile = userHome.getNode(ARGEO_PROFILE); + + // compatibility with legacy, will be removed + if (!userProfile.hasProperty(ARGEO_ENABLED)) { + session.getWorkspace().getVersionManager() + .checkout(userProfile.getPath()); + userProfile.setProperty(ARGEO_ENABLED, true); + userProfile.setProperty(ARGEO_ACCOUNT_NON_EXPIRED, true); + userProfile.setProperty(ARGEO_ACCOUNT_NON_LOCKED, true); + userProfile + .setProperty(ARGEO_CREDENTIALS_NON_EXPIRED, true); + session.save(); + session.getWorkspace().getVersionManager() + .checkin(userProfile.getPath()); + } } else { userProfile = JcrUtils.createUserProfile(securitySession, username); -- 2.39.2