You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2012/09/10 17:18:46 UTC
svn commit: r1382936 -
/incubator/syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/util/ConnObjectUtil.java
Author: ilgrosso
Date: Mon Sep 10 15:18:46 2012
New Revision: 1382936
URL: http://svn.apache.org/viewvc?rev=1382936&view=rev
Log:
[SYNCOPE-194] Not updating user password from external resource when the underlying connector does not return any value for it
Modified:
incubator/syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/util/ConnObjectUtil.java
Modified: incubator/syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/util/ConnObjectUtil.java
URL: http://svn.apache.org/viewvc/incubator/syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/util/ConnObjectUtil.java?rev=1382936&r1=1382935&r2=1382936&view=diff
==============================================================================
--- incubator/syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/util/ConnObjectUtil.java (original)
+++ incubator/syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/util/ConnObjectUtil.java Mon Sep 10 15:18:46 2012
@@ -82,14 +82,14 @@ public class ConnObjectUtil {
* Build an UserTO out of connector object attributes and schema mapping.
*
* @param obj connector object
+ * @param syncTask synchronization task
* @return UserTO for the user to be created
*/
@Transactional(readOnly = true)
public UserTO getUserTO(final ConnectorObject obj, final SyncTask syncTask) {
-
UserTO userTO = getUserTOFromConnObject(obj, syncTask);
- // 3. if password was not set above, generate a random string
+ // if password was not set above, generate a random string
if (StringUtils.isBlank(userTO.getPassword())) {
userTO.setPassword(RandomStringUtils.randomAlphanumeric(16));
}
@@ -102,6 +102,7 @@ public class ConnObjectUtil {
*
* @param userId user to be updated
* @param obj connector object
+ * @param syncTask synchronization task
* @return UserMod for the user to be updated
*/
@Transactional(readOnly = true)
@@ -114,11 +115,9 @@ public class ConnObjectUtil {
final UserTO updated = getUserTOFromConnObject(obj, syncTask);
updated.setId(userId);
- if (StringUtils.isNotBlank(updated.getPassword())) {
- // update password if and only if password has really changed
- if (userDataBinder.verifyPassword(user, updated.getPassword())) {
- updated.setPassword(null);
- }
+ // update password if and only if password is really changed
+ if (StringUtils.isBlank(updated.getPassword()) || userDataBinder.verifyPassword(user, updated.getPassword())) {
+ updated.setPassword(null);
}
final UserMod userMod = AttributableOperations.diff(updated, original, true);