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 2013/12/04 15:43:49 UTC

svn commit: r1547809 - in /syncope/branches/1_1_X: console/ console/src/main/java/org/apache/syncope/console/pages/ console/src/main/java/org/apache/syncope/console/pages/panels/ core/src/main/java/org/apache/syncope/core/propagation/impl/ core/src/mai...

Author: ilgrosso
Date: Wed Dec  4 14:43:48 2013
New Revision: 1547809

URL: http://svn.apache.org/r1547809
Log:
[SYNCOPE-454] Passing an empty password change request does imply not send any password out during propagation

Modified:
    syncope/branches/1_1_X/console/pom.xml
    syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/pages/EditUserModalPage.java
    syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/pages/Reports.java
    syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/pages/panels/StatusPanel.java
    syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/propagation/impl/PropagationManager.java
    syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/RoleController.java
    syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java
    syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/sync/impl/LDAPMembershipSyncActions.java
    syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopeSyncResultHandler.java
    syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/util/MappingUtil.java
    syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java
    syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/RoleTestITCase.java
    syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java
    syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/VirAttrTestITCase.java

Modified: syncope/branches/1_1_X/console/pom.xml
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/console/pom.xml?rev=1547809&r1=1547808&r2=1547809&view=diff
==============================================================================
--- syncope/branches/1_1_X/console/pom.xml (original)
+++ syncope/branches/1_1_X/console/pom.xml Wed Dec  4 14:43:48 2013
@@ -193,12 +193,13 @@ under the License.
             <phase>pre-integration-test</phase>
             <configuration>
               <target>
-                <unzip src="${basedir}/../core/target/syncope.war" dest="${cargo.run.dir}" />
-                <copy file="${project.build.directory}/test-classes/db.jsp" todir="${cargo.run.dir}" />
+                <unzip src="${basedir}/../core/target/syncope.war" dest="${cargo.run.dir}"/>
+                <copy file="${project.build.directory}/test-classes/db.jsp" todir="${cargo.run.dir}"/>
                 <copy todir="${cargo.run.dir}/WEB-INF/classes" includeEmptyDirs="false">
                   <fileset dir="${project.build.directory}/test-classes">
-                    <exclude name="**/*.class" />
-                    <exclude name="restClientContext.xml" />
+                    <exclude name="**/*.class"/>
+                    <exclude name="restClientContext.xml"/>
+                    <exclude name="rest.properties"/>
                   </fileset>
                 </copy>
               </target>
@@ -212,7 +213,7 @@ under the License.
             <phase>pre-integration-test</phase>
             <configuration>
               <target>
-                <copy file="${project.build.directory}/test-classes/test.csv" todir="${test.csvdir.path}" overwrite="true" />
+                <copy file="${project.build.directory}/test-classes/test.csv" todir="${test.csvdir.path}" overwrite="true"/>
               </target>
             </configuration>
             <goals>
@@ -381,7 +382,7 @@ under the License.
     <profile>
       <id>skipTests</id>
       <properties>
-        <javaagent />
+        <javaagent/>
       </properties>
       
       <build>
@@ -538,7 +539,7 @@ under the License.
       <id>selenium</id>
       
       <properties>
-        <javaagent />
+        <javaagent/>
       </properties>
       
       <build>

Modified: syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/pages/EditUserModalPage.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/pages/EditUserModalPage.java?rev=1547809&r1=1547808&r2=1547809&view=diff
==============================================================================
--- syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/pages/EditUserModalPage.java (original)
+++ syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/pages/EditUserModalPage.java Wed Dec  4 14:43:48 2013
@@ -74,6 +74,7 @@ public class EditUserModalPage extends U
         }
     }
 
+    @SuppressWarnings("rawtypes")
     @Override
     protected void submitAction(final AjaxRequestTarget target, final Form form) {
         final UserTO updatedUserTO = (UserTO) form.getModelObject();
@@ -94,6 +95,7 @@ public class EditUserModalPage extends U
         }
     }
 
+    @SuppressWarnings("rawtypes")
     @Override
     protected void closeAction(final AjaxRequestTarget target, final Form form) {
         setResponsePage(new ResultStatusModalPage.Builder(window, userTO).mode(mode).build());

Modified: syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/pages/Reports.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/pages/Reports.java?rev=1547809&r1=1547808&r2=1547809&view=diff
==============================================================================
--- syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/pages/Reports.java (original)
+++ syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/pages/Reports.java Wed Dec  4 14:43:48 2013
@@ -105,7 +105,7 @@ public class Reports extends BasePage {
         setupAudit();
     }
 
-    @SuppressWarnings({"rawtypes", "unchecked"})
+    @SuppressWarnings({ "rawtypes", "unchecked" })
     private void setupReport() {
         reportContainer = new WebMarkupContainer("reportContainer");
         setWindowClosedCallback(window, reportContainer);
@@ -272,6 +272,7 @@ public class Reports extends BasePage {
         add(createLink);
     }
 
+    @SuppressWarnings("rawtypes")
     private void setupAudit() {
         auditContainer = new WebMarkupContainer("auditContainer");
         auditContainer.setOutputMarkupId(true);
@@ -300,77 +301,79 @@ public class Reports extends BasePage {
         form.add(new LoggerCategoryPanel(
                 "events", loggerRestClient.listEvents(), model, getPageReference(), "Reports") {
 
-            private static final long serialVersionUID = 6113164334533550277L;
+                    private static final long serialVersionUID = 6113164334533550277L;
 
-            @Override
-            protected String[] getListRoles() {
-                return new String[] {
-                    xmlRolesReader.getAllAllowedRoles("Audit", "list")
-                };
-            }
+                    @Override
+                    protected String[] getListRoles() {
+                        return new String[] {
+                            xmlRolesReader.getAllAllowedRoles("Audit", "list")
+                        };
+                    }
 
-            @Override
-            protected String[] getChangeRoles() {
-                return new String[] {
-                    xmlRolesReader.getAllAllowedRoles("Audit", "enable"),
-                    xmlRolesReader.getAllAllowedRoles("Audit", "disable")
-                };
-            }
+                    @Override
+                    protected String[] getChangeRoles() {
+                        return new String[] {
+                            xmlRolesReader.getAllAllowedRoles("Audit", "enable"),
+                            xmlRolesReader.getAllAllowedRoles("Audit", "disable")
+                        };
+                    }
 
-            @Override
-            public void onEventAction(final IEvent<?> event) {
-                if (event.getPayload() instanceof SelectedEventsPanel.EventSelectionChanged) {
+                    @Override
+                    public void onEventAction(final IEvent<?> event) {
+                        if (event.getPayload() instanceof SelectedEventsPanel.EventSelectionChanged) {
 
-                    final SelectedEventsPanel.EventSelectionChanged eventSelectionChanged =
+                            final SelectedEventsPanel.EventSelectionChanged eventSelectionChanged =
                             (SelectedEventsPanel.EventSelectionChanged) event.getPayload();
 
-                    for (String toBeRemoved : eventSelectionChanged.getToBeRemoved()) {
-                        if (events.contains(toBeRemoved)) {
-                            final Map.Entry<EventCategoryTO, Result> eventCategory =
+                            for (String toBeRemoved : eventSelectionChanged.getToBeRemoved()) {
+                                if (events.contains(toBeRemoved)) {
+                                    final Map.Entry<EventCategoryTO, Result> eventCategory =
                                     LoggerEventUtils.parseEventCategory(toBeRemoved);
 
-                            final AuditLoggerName auditLoggerName = new AuditLoggerName(
-                                    eventCategory.getKey().getType(),
-                                    eventCategory.getKey().getCategory(),
-                                    eventCategory.getKey().getSubcategory(),
-                                    CollectionUtils.isEmpty(eventCategory.getKey().getEvents())
-                                    ? null : eventCategory.getKey().getEvents().iterator().next(),
-                                    eventCategory.getValue());
-
-                            loggerRestClient.disableAudit(auditLoggerName);
-                            events.remove(toBeRemoved);
-                        }
-                    }
+                                    final AuditLoggerName auditLoggerName = new AuditLoggerName(
+                                            eventCategory.getKey().getType(),
+                                            eventCategory.getKey().getCategory(),
+                                            eventCategory.getKey().getSubcategory(),
+                                            CollectionUtils.isEmpty(eventCategory.getKey().getEvents())
+                                            ? null : eventCategory.getKey().getEvents().iterator().next(),
+                                            eventCategory.getValue());
+
+                                    loggerRestClient.disableAudit(auditLoggerName);
+                                    events.remove(toBeRemoved);
+                                }
+                            }
 
-                    for (String toBeAdded : eventSelectionChanged.getToBeAdded()) {
-                        if (!events.contains(toBeAdded)) {
-                            final Map.Entry<EventCategoryTO, Result> eventCategory =
+                            for (String toBeAdded : eventSelectionChanged.getToBeAdded()) {
+                                if (!events.contains(toBeAdded)) {
+                                    final Map.Entry<EventCategoryTO, Result> eventCategory =
                                     LoggerEventUtils.parseEventCategory(toBeAdded);
 
-                            final AuditLoggerName auditLoggerName = new AuditLoggerName(
-                                    eventCategory.getKey().getType(),
-                                    eventCategory.getKey().getCategory(),
-                                    eventCategory.getKey().getSubcategory(),
-                                    CollectionUtils.isEmpty(eventCategory.getKey().getEvents())
-                                    ? null : eventCategory.getKey().getEvents().iterator().next(),
-                                    eventCategory.getValue());
-
-                            loggerRestClient.enableAudit(auditLoggerName);
-                            events.add(toBeAdded);
+                                    final AuditLoggerName auditLoggerName = new AuditLoggerName(
+                                            eventCategory.getKey().getType(),
+                                            eventCategory.getKey().getCategory(),
+                                            eventCategory.getKey().getSubcategory(),
+                                            CollectionUtils.isEmpty(eventCategory.getKey().getEvents())
+                                            ? null : eventCategory.getKey().getEvents().iterator().next(),
+                                            eventCategory.getValue());
+
+                                    loggerRestClient.enableAudit(auditLoggerName);
+                                    events.add(toBeAdded);
+                                }
+                            }
                         }
                     }
-                }
-            }
-        });
+                });
     }
 
     private class ReportProvider extends SortableDataProvider<ReportTO, String> {
 
         private static final long serialVersionUID = -2311716167583335852L;
 
-        private SortableDataProviderComparator<ReportTO> comparator;
+        private final SortableDataProviderComparator<ReportTO> comparator;
 
         public ReportProvider() {
+            super();
+
             //Default sorting
             setSort("id", SortOrder.ASCENDING);
             comparator = new SortableDataProviderComparator<ReportTO>(this);

Modified: syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/pages/panels/StatusPanel.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/pages/panels/StatusPanel.java?rev=1547809&r1=1547808&r2=1547809&view=diff
==============================================================================
--- syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/pages/panels/StatusPanel.java (original)
+++ syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/pages/panels/StatusPanel.java Wed Dec  4 14:43:48 2013
@@ -266,12 +266,11 @@ public class StatusPanel extends Panel i
     }
 
     public PropagationRequestTO getPropagationRequestTO() {
-        PropagationRequestTO result = null;
+        PropagationRequestTO result = new PropagationRequestTO();
 
         Collection<StatusBean> statusBeans = checkGroup.getModel().getObject();
         if (statusBeans != null && !statusBeans.isEmpty()) {
             result = StatusUtils.buildPropagationRequestTO(statusBeans);
-
         }
 
         return result;

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/propagation/impl/PropagationManager.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/propagation/impl/PropagationManager.java?rev=1547809&r1=1547808&r2=1547809&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/propagation/impl/PropagationManager.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/propagation/impl/PropagationManager.java Wed Dec  4 14:43:48 2013
@@ -58,6 +58,7 @@ import org.apache.syncope.core.workflow.
 import org.identityconnectors.framework.common.objects.Attribute;
 import org.identityconnectors.framework.common.objects.AttributeBuilder;
 import org.identityconnectors.framework.common.objects.AttributeUtil;
+import org.identityconnectors.framework.common.objects.OperationalAttributes;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -66,7 +67,7 @@ import org.springframework.transaction.a
 /**
  * Manage the data propagation to external resources.
  */
-@Transactional(rollbackFor = {Throwable.class})
+@Transactional(rollbackFor = { Throwable.class })
 public class PropagationManager {
 
     /**
@@ -196,7 +197,7 @@ public class PropagationManager {
             propByRes.get(ResourceOperation.CREATE).removeAll(noPropResourceNames);
         }
 
-        return createTasks(attributable, password, null, null, enable, false, propByRes);
+        return createTasks(attributable, password, true, null, null, enable, false, propByRes);
     }
 
     /**
@@ -215,6 +216,7 @@ public class PropagationManager {
         return getUpdateTaskIds(
                 user, // SyncopeUser to be updated on external resources
                 null, // no password
+                false,
                 enable, // status to be propagated
                 Collections.<String>emptySet(), // no virtual attributes to be managed
                 Collections.<AttributeMod>emptySet(), // no virtual attributes to be managed
@@ -234,7 +236,7 @@ public class PropagationManager {
             throws NotFoundException, UnauthorizedRoleException {
 
         return getUserUpdateTaskIds(
-                wfResult, null, Collections.<String>emptySet(), Collections.<AttributeMod>emptySet(), null);
+                wfResult, null, false, Collections.<String>emptySet(), Collections.<AttributeMod>emptySet(), null);
     }
 
     /**
@@ -252,7 +254,7 @@ public class PropagationManager {
             final String password, final Set<String> vAttrsToBeRemoved, final Set<AttributeMod> vAttrsToBeUpdated)
             throws NotFoundException, UnauthorizedRoleException {
 
-        return getUserUpdateTaskIds(wfResult, password, vAttrsToBeRemoved, vAttrsToBeUpdated, null);
+        return getUserUpdateTaskIds(wfResult, password, true, vAttrsToBeRemoved, vAttrsToBeUpdated, null);
     }
 
     /**
@@ -260,6 +262,7 @@ public class PropagationManager {
      *
      * @param wfResult user to be propagated (and info associated), as per result from workflow
      * @param password to be updated
+     * @param changePwd whether password should be included for propagation attributes or not
      * @param vAttrsToBeRemoved virtual attributes to be removed
      * @param vAttrsToBeUpdated virtual attributes to be added
      * @param noPropResourceNames external resources not to be considered for propagation
@@ -268,12 +271,13 @@ public class PropagationManager {
      * @throws UnauthorizedRoleException if caller doesn't own enough entitlements to administer the given user
      */
     public List<PropagationTask> getUserUpdateTaskIds(final WorkflowResult<Map.Entry<Long, Boolean>> wfResult,
-            final String password, final Set<String> vAttrsToBeRemoved, final Set<AttributeMod> vAttrsToBeUpdated,
+            final String password, final boolean changePwd,
+            final Set<String> vAttrsToBeRemoved, final Set<AttributeMod> vAttrsToBeUpdated,
             final Set<String> noPropResourceNames)
             throws NotFoundException, UnauthorizedRoleException {
 
         SyncopeUser user = userDataBinder.getUserFromId(wfResult.getResult().getKey());
-        return getUpdateTaskIds(user, password, wfResult.getResult().getValue(),
+        return getUpdateTaskIds(user, password, changePwd, wfResult.getResult().getValue(),
                 vAttrsToBeRemoved, vAttrsToBeUpdated, wfResult.getPropByRes(), noPropResourceNames);
     }
 
@@ -311,12 +315,12 @@ public class PropagationManager {
             throws NotFoundException, UnauthorizedRoleException {
 
         SyncopeRole role = roleDataBinder.getRoleFromId(wfResult.getResult());
-        return getUpdateTaskIds(role, null, null,
+        return getUpdateTaskIds(role, null, false, null,
                 vAttrsToBeRemoved, vAttrsToBeUpdated, wfResult.getPropByRes(), noPropResourceNames);
     }
 
     protected List<PropagationTask> getUpdateTaskIds(final AbstractAttributable attributable,
-            final String password, final Boolean enable,
+            final String password, final boolean changePwd, final Boolean enable,
             final Set<String> vAttrsToBeRemoved, final Set<AttributeMod> vAttrsToBeUpdated,
             final PropagationByResource propByRes, final Set<String> noPropResourceNames)
             throws NotFoundException {
@@ -348,7 +352,7 @@ public class PropagationManager {
             }
         }
 
-        return createTasks(attributable, password,
+        return createTasks(attributable, password, changePwd,
                 vAttrsToBeRemoved, vAttrsToBeUpdatedMap, enable, false, localPropByRes);
     }
 
@@ -396,7 +400,7 @@ public class PropagationManager {
      */
     public List<PropagationTask> getUserDeleteTaskIds(final WorkflowResult<Long> wfResult) {
         SyncopeUser user = userDataBinder.getUserFromId(wfResult.getResult());
-        return createTasks(user, null, null, null, false, true, wfResult.getPropByRes());
+        return createTasks(user, null, false, null, null, false, true, wfResult.getPropByRes());
     }
 
     /**
@@ -441,7 +445,7 @@ public class PropagationManager {
         if (noPropResourceName != null) {
             propByRes.get(ResourceOperation.DELETE).remove(noPropResourceName);
         }
-        return createTasks(attributable, null, null, null, false, true, propByRes);
+        return createTasks(attributable, null, false, null, null, false, true, propByRes);
     }
 
     /**
@@ -451,6 +455,7 @@ public class PropagationManager {
      * @param attrUtil user / role
      * @param subject given user / role
      * @param password clear-text password
+     * @param changePwd whether password should be included for propagation attributes or not
      * @param vAttrsToBeRemoved virtual attributes to be removed
      * @param vAttrsToBeUpdated virtual attributes to be added
      * @param enable whether user must be enabled or not
@@ -458,7 +463,7 @@ public class PropagationManager {
      * @return account link + prepared attributes
      */
     protected <T extends AbstractAttributable> Map.Entry<String, Set<Attribute>> prepareAttributes(
-            final AttributableUtil attrUtil, final T subject, final String password,
+            final AttributableUtil attrUtil, final T subject, final String password, final boolean changePwd,
             final Set<String> vAttrsToBeRemoved, final Map<String, AttributeMod> vAttrsToBeUpdated,
             final Boolean enable, final ExternalResource resource) {
 
@@ -483,11 +488,11 @@ public class PropagationManager {
                 Map.Entry<String, Attribute> preparedAttribute = MappingUtil.prepareAttribute(
                         resource, mapping, subject, password, passwordGenerator, vAttrsToBeRemoved, vAttrsToBeUpdated);
 
-                if (preparedAttribute.getKey() != null) {
+                if (preparedAttribute != null && preparedAttribute.getKey() != null) {
                     accountId = preparedAttribute.getKey();
                 }
 
-                if (preparedAttribute.getValue() != null) {
+                if (preparedAttribute != null && preparedAttribute.getValue() != null) {
                     Attribute alreadyAdded = AttributeUtil.find(preparedAttribute.getValue().getName(), attributes);
                     if (alreadyAdded == null) {
                         attributes.add(preparedAttribute.getValue());
@@ -510,6 +515,12 @@ public class PropagationManager {
         if (enable != null) {
             attributes.add(AttributeBuilder.buildEnabled(enable));
         }
+        if (!changePwd) {
+            Attribute pwdAttr = AttributeUtil.find(OperationalAttributes.PASSWORD_NAME, attributes);
+            if (pwdAttr != null) {
+                attributes.remove(pwdAttr);
+            }
+        }
 
         return new SimpleEntry<String, Set<Attribute>>(accountId, attributes);
     }
@@ -520,6 +531,7 @@ public class PropagationManager {
      * @param <T> user / role
      * @param subject user / role to be provisioned
      * @param password cleartext password to be provisioned
+     * @param changePwd whether password should be included for propagation attributes or not
      * @param vAttrsToBeRemoved virtual attributes to be removed
      * @param vAttrsToBeUpdated virtual attributes to be added
      * @param enable whether user must be enabled or not
@@ -527,7 +539,8 @@ public class PropagationManager {
      * @param propByRes operation to be performed per resource
      * @return list of propagation tasks created
      */
-    protected <T extends AbstractAttributable> List<PropagationTask> createTasks(final T subject, final String password,
+    protected <T extends AbstractAttributable> List<PropagationTask> createTasks(final T subject,
+            final String password, final boolean changePwd,
             final Set<String> vAttrsToBeRemoved, final Map<String, AttributeMod> vAttrsToBeUpdated,
             final Boolean enable, final boolean deleteOnResource,
             final PropagationByResource propByRes) {
@@ -579,8 +592,8 @@ public class PropagationManager {
                     task.setPropagationMode(resource.getPropagationMode());
                     task.setOldAccountId(propByRes.getOldAccountId(resource.getName()));
 
-                    Map.Entry<String, Set<Attribute>> preparedAttrs = prepareAttributes(attrUtil, subject, password,
-                            vAttrsToBeRemoved, vAttrsToBeUpdated, enable, resource);
+                    Map.Entry<String, Set<Attribute>> preparedAttrs = prepareAttributes(attrUtil, subject,
+                            password, changePwd, vAttrsToBeRemoved, vAttrsToBeUpdated, enable, resource);
                     task.setAccountId(preparedAttrs.getKey());
 
                     // Check if any of mandatory attributes (in the mapping) is missing or not received any value: 

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/RoleController.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/RoleController.java?rev=1547809&r1=1547808&r2=1547809&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/RoleController.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/RoleController.java Wed Dec  4 14:43:48 2013
@@ -173,7 +173,7 @@ public class RoleController extends Abst
 
     @PreAuthorize("hasRole('ROLE_READ')")
     @RequestMapping(method = RequestMethod.POST, value = "/search")
-    @Transactional(readOnly = true, rollbackFor = {Throwable.class})
+    @Transactional(readOnly = true, rollbackFor = { Throwable.class })
     public List<RoleTO> search(@RequestBody final NodeCond searchCondition)
             throws InvalidSearchConditionException {
 
@@ -182,7 +182,7 @@ public class RoleController extends Abst
 
     @PreAuthorize("hasRole('ROLE_READ')")
     @RequestMapping(method = RequestMethod.POST, value = "/search/{page}/{size}")
-    @Transactional(readOnly = true, rollbackFor = {Throwable.class})
+    @Transactional(readOnly = true, rollbackFor = { Throwable.class })
     public List<RoleTO> search(@RequestBody final NodeCond searchCondition, @PathVariable("page") final int page,
             @PathVariable("size") final int size)
             throws InvalidSearchConditionException {
@@ -206,7 +206,7 @@ public class RoleController extends Abst
 
     @PreAuthorize("hasRole('ROLE_READ')")
     @RequestMapping(method = RequestMethod.POST, value = "/search/count")
-    @Transactional(readOnly = true, rollbackFor = {Throwable.class})
+    @Transactional(readOnly = true, rollbackFor = { Throwable.class })
     public ModelAndView searchCount(@RequestBody final NodeCond searchCondition)
             throws InvalidSearchConditionException {
 
@@ -306,7 +306,7 @@ public class RoleController extends Abst
         final List<SyncopeRole> toBeDeprovisioned = new ArrayList<SyncopeRole>();
 
         final SyncopeRole syncopeRole = roleDAO.find(roleId);
-        
+
         if (syncopeRole != null) {
             toBeDeprovisioned.add(syncopeRole);
 

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java?rev=1547809&r1=1547808&r2=1547809&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java Wed Dec  4 14:43:48 2013
@@ -320,6 +320,7 @@ public class UserController extends Abst
                 tasks.addAll(propagationManager.getUserUpdateTaskIds(
                         updated,
                         changedPwd,
+                        true,
                         actual.getVirtualAttributesToBeRemoved(),
                         actual.getVirtualAttributesToBeUpdated(),
                         toBeExcluded));
@@ -335,6 +336,7 @@ public class UserController extends Abst
                 tasks.addAll(propagationManager.getUserUpdateTaskIds(
                         updated,
                         null,
+                        false,
                         actual.getVirtualAttributesToBeRemoved(),
                         actual.getVirtualAttributesToBeUpdated(),
                         pwdResourceNames));
@@ -529,6 +531,7 @@ public class UserController extends Abst
                             updated.getPropByRes(),
                             updated.getPerformedTasks()),
                     updated.getResult().getValue(),
+                    true,
                     null,
                     null,
                     null);

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/sync/impl/LDAPMembershipSyncActions.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/sync/impl/LDAPMembershipSyncActions.java?rev=1547809&r1=1547808&r2=1547809&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/sync/impl/LDAPMembershipSyncActions.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/sync/impl/LDAPMembershipSyncActions.java Wed Dec  4 14:43:48 2013
@@ -211,7 +211,9 @@ public class LDAPMembershipSyncActions e
             updated = uwfAdapter.update(userMod);
 
             List<PropagationTask> tasks = propagationManager.getUserUpdateTaskIds(updated,
-                    userMod.getPassword(), userMod.getVirtualAttributesToBeRemoved(),
+                    null,
+                    false,
+                    userMod.getVirtualAttributesToBeRemoved(),
                     userMod.getVirtualAttributesToBeUpdated(),
                     Collections.singleton(resourceName));
 

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopeSyncResultHandler.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopeSyncResultHandler.java?rev=1547809&r1=1547808&r2=1547809&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopeSyncResultHandler.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/sync/impl/SyncopeSyncResultHandler.java Wed Dec  4 14:43:48 2013
@@ -377,7 +377,6 @@ public class SyncopeSyncResultHandler im
             final ConnectorObject connObj, final List<String> altSearchSchemas, final AttributableUtil attrUtil) {
 
         // search for external attribute's name/value of each specified name
-
         final Map<String, Attribute> extValues = new HashMap<String, Attribute>();
 
         for (AbstractMappingItem item
@@ -476,7 +475,7 @@ public class SyncopeSyncResultHandler im
 
         final List<ConnectorObject> found = connector.search(objectClass,
                 new EqualsFilter(new Name(name)), connector.getOperationOptions(
-                attrUtil.getMappingItems(syncTask.getResource(), MappingPurpose.SYNCHRONIZATION)));
+                        attrUtil.getMappingItems(syncTask.getResource(), MappingPurpose.SYNCHRONIZATION)));
 
         if (found.isEmpty()) {
             LOG.debug("No {} found on {} with __NAME__ {}", objectClass, syncTask.getResource(), name);
@@ -681,6 +680,7 @@ public class SyncopeSyncResultHandler im
 
         List<PropagationTask> tasks = propagationManager.getUserUpdateTaskIds(updated,
                 actual.getPassword(),
+                actual.getPassword() != null,
                 actual.getVirtualAttributesToBeRemoved(),
                 actual.getVirtualAttributesToBeUpdated(),
                 Collections.singleton(syncTask.getResource().getName()));

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/util/MappingUtil.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/util/MappingUtil.java?rev=1547809&r1=1547808&r2=1547809&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/util/MappingUtil.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/util/MappingUtil.java Wed Dec  4 14:43:48 2013
@@ -246,8 +246,12 @@ public final class MappingUtil {
                 }
             }
 
-            result = new AbstractMap.SimpleEntry<String, Attribute>(null,
-                    AttributeBuilder.buildPassword(passwordAttrValue.toCharArray()));
+            if (passwordAttrValue == null) {
+                result = null;
+            } else {
+                result = new AbstractMap.SimpleEntry<String, Attribute>(null,
+                        AttributeBuilder.buildPassword(passwordAttrValue.toCharArray()));
+            }
         } else {
             if ((schema != null && schema.isMultivalue()) || AttributableUtil.getInstance(subject).getType()
                     != mapItem.getIntMappingType().getAttributableType()) {

Modified: syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java?rev=1547809&r1=1547808&r2=1547809&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java (original)
+++ syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java Wed Dec  4 14:43:48 2013
@@ -22,8 +22,12 @@ import static org.junit.Assert.assertNot
 import static org.junit.Assert.fail;
 
 import java.util.ArrayList;
+import java.util.Hashtable;
 import java.util.List;
+import java.util.Map;
 import java.util.UUID;
+import javax.naming.Context;
+import javax.naming.directory.InitialDirContext;
 
 import javax.sql.DataSource;
 import javax.ws.rs.core.MediaType;
@@ -72,12 +76,12 @@ import org.apache.syncope.common.service
 import org.apache.syncope.common.services.WorkflowService;
 import org.apache.syncope.common.to.AbstractSchemaTO;
 import org.apache.syncope.common.to.AttributeTO;
-import org.apache.syncope.common.to.ConnObjectTO;
 import org.apache.syncope.common.to.PolicyTO;
 import org.apache.syncope.common.to.ResourceTO;
 import org.apache.syncope.common.to.RoleTO;
 import org.apache.syncope.common.to.UserTO;
 import org.apache.syncope.common.types.AttributableType;
+import org.apache.syncope.common.types.ConnConfProperty;
 import org.apache.syncope.common.types.PolicyType;
 import org.apache.syncope.common.types.SchemaType;
 import org.apache.syncope.common.validation.SyncopeClientErrorHandler;
@@ -93,7 +97,7 @@ import org.springframework.test.context.
 import org.springframework.web.client.RestTemplate;
 
 @RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = {"classpath:restClientContext.xml", "classpath:testJDBCContext.xml"})
+@ContextConfiguration(locations = { "classpath:restClientContext.xml", "classpath:testJDBCContext.xml" })
 public abstract class AbstractTest {
 
     /**
@@ -218,10 +222,6 @@ public abstract class AbstractTest {
         }
     }
 
-    protected ConnObjectTO readConnectorObject(final String resourceName, final Long userId, AttributableType type) {
-        return resourceService.getConnectorObject(resourceName, type, userId);
-    }
-
     // BEGIN Spring MVC Initialization
     private void setupRestTemplate(final String uid, final String pwd) {
         PreemptiveAuthHttpRequestFactory requestFactory = ((PreemptiveAuthHttpRequestFactory) restTemplate
@@ -458,4 +458,32 @@ public abstract class AbstractTest {
         }
         return getObject(response, ResourceTO.class, resourceService);
     }
+
+    protected Object getLdapRemoteObject(final String objectDn) {
+        return getLdapRemoteObject(null, null, objectDn);
+    }
+
+    @SuppressWarnings({ "unchecked", "rawtypes", "UseOfObsoleteCollectionType" })
+    protected Object getLdapRemoteObject(final String bindDn, final String bindPwd, final String objectDn) {
+        ResourceTO ldapRes = resourceService.read(RESOURCE_NAME_LDAP);
+        final Map<String, ConnConfProperty> ldapConnConf =
+                connectorService.read(ldapRes.getConnectorId()).getConfigurationMap();
+
+        Hashtable env = new Hashtable();
+        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
+        env.put(Context.PROVIDER_URL, "ldap://" + ldapConnConf.get("host").getValues().get(0)
+                + ":" + ldapConnConf.get("port").getValues().get(0) + "/");
+        env.put(Context.SECURITY_AUTHENTICATION, "simple");
+        env.put(Context.SECURITY_PRINCIPAL,
+                bindDn == null ? ldapConnConf.get("principal").getValues().get(0) : bindDn);
+        env.put(Context.SECURITY_CREDENTIALS,
+                bindPwd == null ? ldapConnConf.get("credentials").getValues().get(0) : bindPwd);
+
+        try {
+            final InitialDirContext ctx = new InitialDirContext(env);
+            return ctx.lookup(objectDn);
+        } catch (Exception e) {
+            return null;
+        }
+    }
 }

Modified: syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/RoleTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/RoleTestITCase.java?rev=1547809&r1=1547808&r2=1547809&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/RoleTestITCase.java (original)
+++ syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/RoleTestITCase.java Wed Dec  4 14:43:48 2013
@@ -27,20 +27,14 @@ import static org.junit.Assert.fail;
 
 import java.security.AccessControlException;
 import java.util.ArrayList;
-import java.util.Hashtable;
 import java.util.List;
-import java.util.Map;
-import javax.naming.Context;
-import javax.naming.directory.InitialDirContext;
 
 import org.apache.syncope.common.mod.RoleMod;
 import org.apache.syncope.common.services.RoleService;
 import org.apache.syncope.common.to.ConnObjectTO;
-import org.apache.syncope.common.to.ResourceTO;
 import org.apache.syncope.common.to.RoleTO;
 import org.apache.syncope.common.to.UserTO;
 import org.apache.syncope.common.types.AttributableType;
-import org.apache.syncope.common.types.ConnConfProperty;
 import org.apache.syncope.common.types.SyncopeClientExceptionType;
 import org.apache.syncope.common.validation.SyncopeClientCompositeErrorException;
 import org.apache.syncope.common.validation.SyncopeClientException;
@@ -114,7 +108,8 @@ public class RoleTestITCase extends Abst
 
         assertTrue(roleTO.getResources().contains(RESOURCE_NAME_LDAP));
 
-        ConnObjectTO connObjectTO = readConnectorObject(RESOURCE_NAME_LDAP, roleTO.getId(), AttributableType.ROLE);
+        ConnObjectTO connObjectTO =
+                resourceService.getConnectorObject(RESOURCE_NAME_LDAP, AttributableType.ROLE, roleTO.getId());
         assertNotNull(connObjectTO);
         assertNotNull(connObjectTO.getAttributeMap().get("owner"));
     }
@@ -391,7 +386,7 @@ public class RoleTestITCase extends Abst
         assertTrue(parent.getResources().contains(RESOURCE_NAME_LDAP));
 
         final ConnObjectTO parentRemoteObject =
-                readConnectorObject(RESOURCE_NAME_LDAP, parent.getId(), AttributableType.ROLE);
+                resourceService.getConnectorObject(RESOURCE_NAME_LDAP, AttributableType.ROLE, parent.getId());
         assertNotNull(parentRemoteObject);
         assertNotNull(getLdapRemoteObject(parentRemoteObject.getAttributeMap().get(Name.NAME).getValues().get(0)));
 
@@ -404,7 +399,7 @@ public class RoleTestITCase extends Abst
         assertTrue(child.getResources().contains(RESOURCE_NAME_LDAP));
 
         final ConnObjectTO childRemoteObject =
-                readConnectorObject(RESOURCE_NAME_LDAP, child.getId(), AttributableType.ROLE);
+                resourceService.getConnectorObject(RESOURCE_NAME_LDAP, AttributableType.ROLE, child.getId());
         assertNotNull(childRemoteObject);
         assertNotNull(getLdapRemoteObject(childRemoteObject.getAttributeMap().get(Name.NAME).getValues().get(0)));
 
@@ -416,38 +411,17 @@ public class RoleTestITCase extends Abst
             roleService.read(parent.getId());
             fail();
         } catch (SyncopeClientCompositeErrorException scce) {
-            // ignore
+            assertNotNull(scce);
         }
 
         try {
             roleService.read(child.getId());
             fail();
         } catch (SyncopeClientCompositeErrorException scce) {
-            // ignore
+            assertNotNull(scce);
         }
 
         assertNull(getLdapRemoteObject(parentRemoteObject.getAttributeMap().get(Name.NAME).getValues().get(0)));
         assertNull(getLdapRemoteObject(childRemoteObject.getAttributeMap().get(Name.NAME).getValues().get(0)));
     }
-
-    private Object getLdapRemoteObject(final String name) {
-        ResourceTO ldapRes = resourceService.read(RESOURCE_NAME_LDAP);
-        final Map<String, ConnConfProperty> ldapConnConf =
-                connectorService.read(ldapRes.getConnectorId()).getConfigurationMap();
-
-        Hashtable env = new Hashtable();
-        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
-        env.put(Context.PROVIDER_URL, "ldap://" + ldapConnConf.get("host").getValues().get(0)
-                + ":" + ldapConnConf.get("port").getValues().get(0) + "/");
-        env.put(Context.SECURITY_AUTHENTICATION, "simple");
-        env.put(Context.SECURITY_PRINCIPAL, ldapConnConf.get("principal").getValues().get(0));
-        env.put(Context.SECURITY_CREDENTIALS, ldapConnConf.get("credentials").getValues().get(0));
-
-        try {
-            final InitialDirContext ctx = new InitialDirContext(env);
-            return ctx.lookup(name);
-        } catch (Exception e) {
-            return null;
-        }
-    }
 }

Modified: syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java?rev=1547809&r1=1547808&r2=1547809&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java (original)
+++ syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java Wed Dec  4 14:43:48 2013
@@ -34,6 +34,7 @@ import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+import javax.naming.NamingException;
 
 import javax.ws.rs.core.Response;
 
@@ -72,6 +73,7 @@ import org.apache.syncope.common.validat
 import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
 import org.apache.syncope.core.persistence.dao.NotFoundException;
 import org.apache.syncope.core.workflow.ActivitiDetector;
+import org.identityconnectors.framework.common.objects.Name;
 import org.identityconnectors.framework.common.objects.OperationalAttributes;
 import org.junit.Assume;
 import org.junit.FixMethodOrder;
@@ -577,7 +579,7 @@ public class UserTestITCase extends Abst
         Exception exception = null;
         try {
             jdbcTemplate.queryForObject("SELECT id FROM test WHERE id=?",
-                    new String[] {userTO.getUsername()}, Integer.class);
+                    new String[] { userTO.getUsername() }, Integer.class);
         } catch (EmptyResultDataAccessException e) {
             exception = e;
         }
@@ -614,7 +616,7 @@ public class UserTestITCase extends Abst
         Exception exception = null;
         try {
             jdbcTemplate.queryForObject("SELECT id FROM test WHERE id=?",
-                    new String[] {userTO.getUsername()}, Integer.class);
+                    new String[] { userTO.getUsername() }, Integer.class);
         } catch (EmptyResultDataAccessException e) {
             exception = e;
         }
@@ -1134,10 +1136,11 @@ public class UserTestITCase extends Abst
         assertNotNull(userTO);
         assertEquals("suspended", userTO.getStatus());
 
-        ConnObjectTO connObjectTO = readConnectorObject(RESOURCE_NAME_TESTDB, userId, AttributableType.USER);
+        ConnObjectTO connObjectTO =
+                resourceService.getConnectorObject(RESOURCE_NAME_TESTDB, AttributableType.USER, userId);
         assertFalse(getBooleanAttribute(connObjectTO, OperationalAttributes.ENABLE_NAME));
 
-        connObjectTO = readConnectorObject(RESOURCE_NAME_LDAP, userId, AttributableType.USER);
+        connObjectTO = resourceService.getConnectorObject(RESOURCE_NAME_LDAP, AttributableType.USER, userId);
         assertNotNull(connObjectTO);
 
         // Suspend and reactivate only on ldap => db and syncope should still show suspended
@@ -1149,7 +1152,7 @@ public class UserTestITCase extends Abst
         assertNotNull(userTO);
         assertEquals("suspended", userTO.getStatus());
 
-        connObjectTO = readConnectorObject(RESOURCE_NAME_TESTDB, userId, AttributableType.USER);
+        connObjectTO = resourceService.getConnectorObject(RESOURCE_NAME_TESTDB, AttributableType.USER, userId);
         assertFalse(getBooleanAttribute(connObjectTO, OperationalAttributes.ENABLE_NAME));
 
         // Reactivate on syncope and db => syncope and db should show the user as active
@@ -1161,7 +1164,7 @@ public class UserTestITCase extends Abst
         assertNotNull(userTO);
         assertEquals("active", userTO.getStatus());
 
-        connObjectTO = readConnectorObject(RESOURCE_NAME_TESTDB, userId, AttributableType.USER);
+        connObjectTO = resourceService.getConnectorObject(RESOURCE_NAME_TESTDB, AttributableType.USER, userId);
         assertTrue(getBooleanAttribute(connObjectTO, OperationalAttributes.ENABLE_NAME));
     }
 
@@ -1262,11 +1265,9 @@ public class UserTestITCase extends Abst
 
         // 2. try to update by adding a resource, but no password: must fail
         UserMod userMod = AttributableOperations.diff(toBeUpdated, original);
-
         assertNotNull(userMod);
 
         toBeUpdated = userService.update(userMod.getId(), userMod);
-
         assertNotNull(toBeUpdated);
 
         assertFalse(toBeUpdated.getVirtualAttributes().isEmpty());
@@ -1364,7 +1365,8 @@ public class UserTestITCase extends Abst
         assertNotNull(actual);
         assertNotNull(actual.getDerivedAttributeMap().get("csvuserid"));
 
-        ConnObjectTO connObjectTO = readConnectorObject(RESOURCE_NAME_CSV, actual.getId(), AttributableType.USER);
+        ConnObjectTO connObjectTO =
+                resourceService.getConnectorObject(RESOURCE_NAME_CSV, AttributableType.USER, actual.getId());
         assertNotNull(connObjectTO);
         assertEquals("sx-dx", connObjectTO.getAttributeMap().get("ROLE").getValues().get(0));
     }
@@ -1391,7 +1393,8 @@ public class UserTestITCase extends Abst
         assertNotNull(actual);
         assertNotNull(actual.getDerivedAttributeMap().get("csvuserid"));
 
-        ConnObjectTO connObjectTO = readConnectorObject(RESOURCE_NAME_CSV, actual.getId(), AttributableType.USER);
+        ConnObjectTO connObjectTO =
+                resourceService.getConnectorObject(RESOURCE_NAME_CSV, AttributableType.USER, actual.getId());
         assertNotNull(connObjectTO);
         assertEquals("sx-dx", connObjectTO.getAttributeMap().get("MEMBERSHIP").getValues().get(0));
     }
@@ -1422,7 +1425,8 @@ public class UserTestITCase extends Abst
         assertEquals(2, actual.getMemberships().size());
         assertEquals(1, actual.getResources().size());
 
-        ConnObjectTO connObjectTO = readConnectorObject(RESOURCE_NAME_CSV, actual.getId(), AttributableType.USER);
+        ConnObjectTO connObjectTO =
+                resourceService.getConnectorObject(RESOURCE_NAME_CSV, AttributableType.USER, actual.getId());
         assertNotNull(connObjectTO);
 
         // -----------------------------------
@@ -1437,7 +1441,7 @@ public class UserTestITCase extends Abst
         assertNotNull(actual);
         assertEquals(1, actual.getMemberships().size());
 
-        connObjectTO = readConnectorObject(RESOURCE_NAME_CSV, actual.getId(), AttributableType.USER);
+        connObjectTO = resourceService.getConnectorObject(RESOURCE_NAME_CSV, AttributableType.USER, actual.getId());
         assertNotNull(connObjectTO);
         // -----------------------------------
 
@@ -1454,7 +1458,7 @@ public class UserTestITCase extends Abst
         assertEquals(1, actual.getMemberships().size());
         assertFalse(actual.getResources().isEmpty());
 
-        connObjectTO = readConnectorObject(RESOURCE_NAME_CSV, actual.getId(), AttributableType.USER);
+        connObjectTO = resourceService.getConnectorObject(RESOURCE_NAME_CSV, AttributableType.USER, actual.getId());
         assertNotNull(connObjectTO);
         // -----------------------------------
 
@@ -1472,7 +1476,7 @@ public class UserTestITCase extends Abst
         assertTrue(actual.getResources().isEmpty());
 
         try {
-            readConnectorObject(RESOURCE_NAME_CSV, actual.getId(), AttributableType.USER);
+            resourceService.getConnectorObject(RESOURCE_NAME_CSV, AttributableType.USER, actual.getId());
             fail("Read should not succeeed");
         } catch (SyncopeClientCompositeErrorException e) {
             assertNotNull(e.getException(SyncopeClientExceptionType.NotFound));
@@ -1503,7 +1507,8 @@ public class UserTestITCase extends Abst
         assertNotNull(actual);
         assertEquals(2, actual.getMemberships().size());
 
-        ConnObjectTO connObjectTO = readConnectorObject(RESOURCE_NAME_LDAP, actual.getId(), AttributableType.USER);
+        ConnObjectTO connObjectTO =
+                resourceService.getConnectorObject(RESOURCE_NAME_LDAP, AttributableType.USER, actual.getId());
         assertNotNull(connObjectTO);
 
         AttributeTO postalAddress = connObjectTO.getAttributeMap().get("postalAddress");
@@ -1532,7 +1537,7 @@ public class UserTestITCase extends Abst
         assertNotNull(actual);
         assertEquals(1, actual.getMemberships().size());
 
-        connObjectTO = readConnectorObject(RESOURCE_NAME_LDAP, actual.getId(), AttributableType.USER);
+        connObjectTO = resourceService.getConnectorObject(RESOURCE_NAME_LDAP, AttributableType.USER, actual.getId());
         assertNotNull(connObjectTO);
 
         postalAddress = connObjectTO.getAttributeMap().get("postalAddress");
@@ -1564,7 +1569,7 @@ public class UserTestITCase extends Abst
 
         // 3. try (and fail) to find this user on the external LDAP resource
         try {
-            readConnectorObject(RESOURCE_NAME_LDAP, userTO.getId(), AttributableType.USER);
+            resourceService.getConnectorObject(RESOURCE_NAME_LDAP, AttributableType.USER, userTO.getId());
             fail("This entry should not be present on this resource");
         } catch (SyncopeClientCompositeErrorException sccee) {
             SyncopeClientException sce = sccee.getException(SyncopeClientExceptionType.NotFound);
@@ -1617,7 +1622,8 @@ public class UserTestITCase extends Abst
         assertEquals(RESOURCE_NAME_DBVIRATTR, userTO.getPropagationStatusTOs().get(0).getResource());
         assertEquals(PropagationTaskExecStatus.SUBMITTED, userTO.getPropagationStatusTOs().get(0).getStatus());
 
-        ConnObjectTO connObjectTO = readConnectorObject(RESOURCE_NAME_DBVIRATTR, userTO.getId(), AttributableType.USER);
+        ConnObjectTO connObjectTO =
+                resourceService.getConnectorObject(RESOURCE_NAME_DBVIRATTR, AttributableType.USER, userTO.getId());
         assertNotNull(connObjectTO);
         assertEquals("virtualvalue", connObjectTO.getAttributeMap().get("USERNAME").getValues().get(0));
         // ----------------------------------
@@ -1811,7 +1817,8 @@ public class UserTestITCase extends Abst
         UserTO actual = createUser(userTO);
         assertNotNull(actual);
 
-        final ConnObjectTO connObjectTO = readConnectorObject(RESOURCE_NAME_CSV, actual.getId(), AttributableType.USER);
+        ConnObjectTO connObjectTO =
+                resourceService.getConnectorObject(RESOURCE_NAME_CSV, AttributableType.USER, actual.getId());
         assertNull(connObjectTO.getAttributeMap().get("email"));
     }
 
@@ -2087,6 +2094,39 @@ public class UserTestITCase extends Abst
                 startsWith("Not attempted because there are mandatory attributes without value(s): [__PASSWORD__]"));
     }
 
+    @Test
+    public void issueSYNCOPE454() throws NamingException {
+        // 1. create user with LDAP resource (with 'Generate password if missing' enabled)
+        UserTO userTO = getUniqueSampleTO("syncope454@syncope.apache.org");
+        userTO.getResources().add(RESOURCE_NAME_LDAP);
+        userTO = createUser(userTO);
+        assertNotNull(userTO);
+
+        // 2. read resource configuration for LDAP binding
+        ConnObjectTO connObject =
+                resourceService.getConnectorObject(RESOURCE_NAME_LDAP, AttributableType.USER, userTO.getId());
+
+        // 3. try (and succeed) to perform simple LDAP binding with provided password ('password123')
+        assertNotNull(getLdapRemoteObject(
+                connObject.getAttributeMap().get(Name.NAME).getValues().get(0),
+                "password123",
+                connObject.getAttributeMap().get(Name.NAME).getValues().get(0)));
+
+        // 4. update user without any password change request
+        UserMod userMod = new UserMod();
+        userMod.setId(userTO.getId());
+        userMod.setPwdPropRequest(new PropagationRequestTO());
+        userMod.getAttributesToBeUpdated().add(attributeMod("surname", "surname2"));
+
+        userService.update(userTO.getId(), userMod);
+
+        // 5. try (and succeed again) to perform simple LDAP binding: password has not changed
+        assertNotNull(getLdapRemoteObject(
+                connObject.getAttributeMap().get(Name.NAME).getValues().get(0),
+                "password123",
+                connObject.getAttributeMap().get(Name.NAME).getValues().get(0)));
+    }
+
     private boolean getBooleanAttribute(final ConnObjectTO connObjectTO, final String attrName) {
         return Boolean.parseBoolean(getStringAttribute(connObjectTO, attrName));
     }

Modified: syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/VirAttrTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/VirAttrTestITCase.java?rev=1547809&r1=1547808&r2=1547809&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/VirAttrTestITCase.java (original)
+++ syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/VirAttrTestITCase.java Wed Dec  4 14:43:48 2013
@@ -100,7 +100,8 @@ public class VirAttrTestITCase extends A
         assertEquals(RESOURCE_NAME_WS2, userTO.getPropagationStatusTOs().get(0).getResource());
         assertEquals(PropagationTaskExecStatus.SUBMITTED, userTO.getPropagationStatusTOs().get(0).getStatus());
 
-        ConnObjectTO connObjectTO = readConnectorObject(RESOURCE_NAME_WS2, userTO.getId(), AttributableType.USER);
+        ConnObjectTO connObjectTO =
+                resourceService.getConnectorObject(RESOURCE_NAME_WS2, AttributableType.USER, userTO.getId());
         assertNotNull(connObjectTO);
         assertEquals("virtualvalue", connObjectTO.getAttributeMap().get("NAME").getValues().get(0));
         // ----------------------------------
@@ -124,7 +125,7 @@ public class VirAttrTestITCase extends A
         assertEquals(RESOURCE_NAME_WS2, userTO.getPropagationStatusTOs().get(0).getResource());
         assertEquals(PropagationTaskExecStatus.SUBMITTED, userTO.getPropagationStatusTOs().get(0).getStatus());
 
-        connObjectTO = readConnectorObject(RESOURCE_NAME_WS2, userTO.getId(), AttributableType.USER);
+        connObjectTO = resourceService.getConnectorObject(RESOURCE_NAME_WS2, AttributableType.USER, userTO.getId());
         assertNotNull(connObjectTO);
         assertEquals("virtualvalue2", connObjectTO.getAttributeMap().get("NAME").getValues().get(0));
         // ----------------------------------
@@ -135,7 +136,7 @@ public class VirAttrTestITCase extends A
         userTO = userService.suspend(userTO.getId());
         assertEquals("suspended", userTO.getStatus());
 
-        connObjectTO = readConnectorObject(RESOURCE_NAME_WS2, userTO.getId(), AttributableType.USER);
+        connObjectTO = resourceService.getConnectorObject(RESOURCE_NAME_WS2, AttributableType.USER, userTO.getId());
         assertNotNull(connObjectTO);
         assertFalse(connObjectTO.getAttributeMap().get("NAME").getValues().isEmpty());
         assertEquals("virtualvalue2", connObjectTO.getAttributeMap().get("NAME").getValues().get(0));
@@ -143,7 +144,7 @@ public class VirAttrTestITCase extends A
         userTO = userService.reactivate(userTO.getId());
         assertEquals("active", userTO.getStatus());
 
-        connObjectTO = readConnectorObject(RESOURCE_NAME_WS2, userTO.getId(), AttributableType.USER);
+        connObjectTO = resourceService.getConnectorObject(RESOURCE_NAME_WS2, AttributableType.USER, userTO.getId());
         assertNotNull(connObjectTO);
         assertFalse(connObjectTO.getAttributeMap().get("NAME").getValues().isEmpty());
         assertEquals("virtualvalue2", connObjectTO.getAttributeMap().get("NAME").getValues().get(0));
@@ -168,7 +169,7 @@ public class VirAttrTestITCase extends A
         assertEquals(RESOURCE_NAME_WS2, userTO.getPropagationStatusTOs().get(0).getResource());
         assertEquals(PropagationTaskExecStatus.SUBMITTED, userTO.getPropagationStatusTOs().get(0).getStatus());
 
-        connObjectTO = readConnectorObject(RESOURCE_NAME_WS2, userTO.getId(), AttributableType.USER);
+        connObjectTO = resourceService.getConnectorObject(RESOURCE_NAME_WS2, AttributableType.USER, userTO.getId());
         assertNotNull(connObjectTO);
         assertEquals("Surname2", connObjectTO.getAttributeMap().get("SURNAME").getValues().get(0));
 
@@ -191,7 +192,7 @@ public class VirAttrTestITCase extends A
         assertEquals(RESOURCE_NAME_WS2, userTO.getPropagationStatusTOs().get(0).getResource());
         assertEquals(PropagationTaskExecStatus.SUBMITTED, userTO.getPropagationStatusTOs().get(0).getStatus());
 
-        connObjectTO = readConnectorObject(RESOURCE_NAME_WS2, userTO.getId(), AttributableType.USER);
+        connObjectTO = resourceService.getConnectorObject(RESOURCE_NAME_WS2, AttributableType.USER, userTO.getId());
         assertNotNull(connObjectTO);
 
         // attribute "name" mapped on virtual attribute "virtualdata" should be reset
@@ -505,7 +506,7 @@ public class VirAttrTestITCase extends A
 
         final Map<String, Object> actuals = jdbcTemplate.queryForMap(
                 "SELECT id, surname, email FROM testsync WHERE id=?",
-                new Object[] {Integer.parseInt(userTO.getAttributeMap().get("aLong").getValues().get(0))});
+                new Object[] { Integer.parseInt(userTO.getAttributeMap().get("aLong").getValues().get(0)) });
 
         assertEquals(userTO.getAttributeMap().get("aLong").getValues().get(0), actuals.get("id").toString());
         assertEquals("ml@role.it", actuals.get("email"));