Merged 5.1.N (5.1.2) to 5.2.N (5.2.1)

125621 rmunteanu: Merged 5.0.N (5.0.4) to 5.1.N (5.1.2)
      125577 abalmus: MNT-15038 : Unexpected behavior when disabling Active Directory user (New feature to sync userAccountControl)
         - Implemented new requirements and tests


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@125792 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Raluca Munteanu
2016-04-26 14:18:45 +00:00
parent c14fbf0467
commit 9b22c4303f
15 changed files with 491 additions and 22 deletions

View File

@@ -848,6 +848,9 @@ public class PersonServiceImpl extends TransactionListenerAdapter implements Per
properties.put(ContentModel.PROP_USERNAME, realUserName);
}
}
checkIfPersonShouldBeDisabledAndSetAspect(personNode, properties);
Map<QName, Serializable> update = nodeService.getProperties(personNode);
update.putAll(properties);
@@ -987,6 +990,8 @@ public class PersonServiceImpl extends TransactionListenerAdapter implements Per
beforeCreateNodeValidationBehaviour.enable();
}
checkIfPersonShouldBeDisabledAndSetAspect(personRef, properties);
if (zones != null)
{
for (String zone : zones)
@@ -1004,6 +1009,26 @@ public class PersonServiceImpl extends TransactionListenerAdapter implements Per
return personRef;
}
private void checkIfPersonShouldBeDisabledAndSetAspect(NodeRef person, Map<QName, Serializable> properties)
{
if (properties.get(ContentModel.PROP_ENABLED) != null)
{
boolean isEnabled = Boolean.parseBoolean(properties.get(ContentModel.PROP_ENABLED).toString());
if (isEnabled)
{
if (nodeService.hasAspect(person, ContentModel.ASPECT_PERSON_DISABLED))
{
nodeService.removeAspect(person, ContentModel.ASPECT_PERSON_DISABLED);
}
}
else
{
nodeService.addAspect(person, ContentModel.ASPECT_PERSON_DISABLED, null);
}
}
}
/**
* {@inheritDoc}
*/