svn commit: r1418240 - in /syncope/branches/1_0_X: parent/pom.xml pom.xml

2012-12-07 Thread ilgrosso
Author: ilgrosso
Date: Fri Dec  7 09:57:50 2012
New Revision: 1418240

URL: http://svn.apache.org/viewvc?rev=1418240view=rev
Log:
[SYNCOPE-243] Reworked a bit the provided patch in order to cover either 
pom.xml and parent/pom.xml

Modified:
syncope/branches/1_0_X/parent/pom.xml
syncope/branches/1_0_X/pom.xml

Modified: syncope/branches/1_0_X/parent/pom.xml
URL: 
http://svn.apache.org/viewvc/syncope/branches/1_0_X/parent/pom.xml?rev=1418240r1=1418239r2=1418240view=diff
==
--- syncope/branches/1_0_X/parent/pom.xml (original)
+++ syncope/branches/1_0_X/parent/pom.xml Fri Dec  7 09:57:50 2012
@@ -966,11 +966,13 @@ under the License.
 exclude**/*.js/exclude
 exclude**/*.csv/exclude
 exclude**/archetype-resources/**/exclude
+exclude**/maven-eclipse.xml/exclude
+exclude**/*.iml/exclude
+exclude**/*.log/exclude
 exclude.externalToolBuilders/**/exclude
-excludemaven-eclipse.xml/exclude
 exclude.git/**/exclude
 exclude.idea/**/exclude
-exclude**/*.iml/exclude
+exclude**/.*/exclude
   /excludes
 /configuration
 executions

Modified: syncope/branches/1_0_X/pom.xml
URL: 
http://svn.apache.org/viewvc/syncope/branches/1_0_X/pom.xml?rev=1418240r1=1418239r2=1418240view=diff
==
--- syncope/branches/1_0_X/pom.xml (original)
+++ syncope/branches/1_0_X/pom.xml Fri Dec  7 09:57:50 2012
@@ -70,11 +70,14 @@ under the License.
 exclude**/*.css/exclude
 exclude**/*.js/exclude
 exclude**/*.csv/exclude
+exclude**/archetype-resources/**/exclude
+exclude**/maven-eclipse.xml/exclude
+exclude**/*.iml/exclude
+exclude**/*.log/exclude
 exclude.externalToolBuilders/**/exclude
-excludemaven-eclipse.xml/exclude
 exclude.git/**/exclude
 exclude.idea/**/exclude
-exclude**/*.iml/exclude
+exclude**/.*/exclude
 !-- Need to explicitely exclude these modules since they are not 
part of the default build
 profile: they will be checked anyway in the apache-release 
profile, as submodules. --
 excludearchetype/**/exclude




svn commit: r1418259 - in /syncope/branches/DEV_ROLE_PROVISIONING: ./ pom.xml

2012-12-07 Thread ilgrosso
Author: ilgrosso
Date: Fri Dec  7 10:29:15 2012
New Revision: 1418259

URL: http://svn.apache.org/viewvc?rev=1418259view=rev
Log:
Merge from trunk

Modified:
syncope/branches/DEV_ROLE_PROVISIONING/   (props changed)
syncope/branches/DEV_ROLE_PROVISIONING/pom.xml

Propchange: syncope/branches/DEV_ROLE_PROVISIONING/
--
  Merged /syncope/trunk:r1416948-1418258
  Merged /syncope/branches/1_0_X:r1416937-1418254

Modified: syncope/branches/DEV_ROLE_PROVISIONING/pom.xml
URL: 
http://svn.apache.org/viewvc/syncope/branches/DEV_ROLE_PROVISIONING/pom.xml?rev=1418259r1=1418258r2=1418259view=diff
==
--- syncope/branches/DEV_ROLE_PROVISIONING/pom.xml (original)
+++ syncope/branches/DEV_ROLE_PROVISIONING/pom.xml Fri Dec  7 10:29:15 2012
@@ -1013,12 +1013,13 @@ under the License.
 exclude**/*.js/exclude
 exclude**/*.csv/exclude
 exclude**/archetype-resources/**/exclude
+exclude**/maven-eclipse.xml/exclude
+exclude**/*.iml/exclude
+exclude**/*.log/exclude
 exclude.externalToolBuilders/**/exclude
-excludemaven-eclipse.xml/exclude
-exclude.gitignore/exclude
 exclude.git/**/exclude
 exclude.idea/**/exclude
-exclude**/*.iml/exclude
+exclude**/.*/exclude
   /excludes
 /configuration
 executions




svn commit: r1418327 - in /syncope/branches/DEV_ROLE_PROVISIONING/core/src: main/java/org/apache/syncope/core/propagation/LDAPMembershipPropagationActions.java test/resources/content.xml

2012-12-07 Thread ilgrosso
Author: ilgrosso
Date: Fri Dec  7 14:29:41 2012
New Revision: 1418327

URL: http://svn.apache.org/viewvc?rev=1418327view=rev
Log:
Adding a utility PropagationActions class allowing transparent LDAP role 
membership propagation

Modified:

syncope/branches/DEV_ROLE_PROVISIONING/core/src/main/java/org/apache/syncope/core/propagation/LDAPMembershipPropagationActions.java
syncope/branches/DEV_ROLE_PROVISIONING/core/src/test/resources/content.xml

Modified: 
syncope/branches/DEV_ROLE_PROVISIONING/core/src/main/java/org/apache/syncope/core/propagation/LDAPMembershipPropagationActions.java
URL: 
http://svn.apache.org/viewvc/syncope/branches/DEV_ROLE_PROVISIONING/core/src/main/java/org/apache/syncope/core/propagation/LDAPMembershipPropagationActions.java?rev=1418327r1=1418326r2=1418327view=diff
==
--- 
syncope/branches/DEV_ROLE_PROVISIONING/core/src/main/java/org/apache/syncope/core/propagation/LDAPMembershipPropagationActions.java
 (original)
+++ 
syncope/branches/DEV_ROLE_PROVISIONING/core/src/main/java/org/apache/syncope/core/propagation/LDAPMembershipPropagationActions.java
 Fri Dec  7 14:29:41 2012
@@ -19,28 +19,42 @@
 package org.apache.syncope.core.propagation;
 
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 import org.apache.commons.jexl2.JexlContext;
 import org.apache.commons.jexl2.MapContext;
 import org.apache.commons.lang.StringUtils;
 import org.apache.syncope.core.persistence.beans.PropagationTask;
 import org.apache.syncope.core.persistence.beans.role.SyncopeRole;
-import org.apache.syncope.core.persistence.dao.RoleDAO;
+import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
+import org.apache.syncope.core.persistence.dao.UserDAO;
 import org.apache.syncope.core.util.JexlUtil;
+import org.apache.syncope.types.AttributableType;
+import org.apache.syncope.types.ResourceOperation;
+import org.identityconnectors.framework.common.objects.Attribute;
 import org.identityconnectors.framework.common.objects.AttributeBuilder;
 import org.identityconnectors.framework.common.objects.ConnectorObject;
-import org.identityconnectors.framework.common.objects.ObjectClass;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 
+/**
+ * Simple action for propagating role memberships to LDAP groups, when the 
same resource is configured for both users
+ * and roles.
+ */
 public class LDAPMembershipPropagationActions extends 
DefaultPropagationActions {
 
 private static final Logger LOG = 
LoggerFactory.getLogger(LDAPMembershipPropagationActions.class);
 
+/**
+ * Allows easy subclassing for the ConnId AD connector bundle.
+ */
+protected static final String GROUP_MEMBERSHIP_ATTR = ldapGroups;
+
 @Autowired
-private RoleDAO roleDAO;
+private UserDAO userDAO;
 
 @Autowired
 private JexlUtil jexlUtil;
@@ -50,10 +64,17 @@ public class LDAPMembershipPropagationAc
 public void before(final PropagationTask task, final ConnectorObject 
beforeObj) {
 super.before(task, beforeObj);
 
-if (beforeObj.getObjectClass() == ObjectClass.ACCOUNT  
task.getResource().getRmapping() != null) {
+if (ResourceOperation.DELETE != task.getPropagationOperation()
+ AttributableType.USER == task.getSubjectType()  
task.getResource().getRmapping() != null) {
+
+SyncopeUser user = userDAO.find(task.getSubjectId());
+if (user == null) {
+throw new IllegalArgumentException(User  + 
task.getSubjectId() +  not found);
+}
+
 ListString roleAccountLinks = new ArrayListString();
-for (SyncopeRole role : roleDAO.findAll()) {
-if (role.getResources().contains(task.getResource())
+for (SyncopeRole role : user.getRoles()) {
+if 
(role.getResourceNames().contains(task.getResource().getName())
  
StringUtils.isNotBlank(task.getResource().getRmapping().getAccountLink())) {
 
 LOG.debug(Evaluating accountLink for {}, role);
@@ -73,10 +94,12 @@ public class LDAPMembershipPropagationAc
 LOG.debug(Role accountLinks to propagate for membership: {}, 
roleAccountLinks);
 
 if (!roleAccountLinks.isEmpty()) {
-task.getAttributes().add(AttributeBuilder.build(ldapGroups, 
roleAccountLinks));
+SetAttribute attributes = new 
HashSetAttribute(task.getAttributes());
+attributes.add(AttributeBuilder.build(GROUP_MEMBERSHIP_ATTR, 
roleAccountLinks));
+task.setAttributes(attributes);
 }
 } else {
-LOG.debug(It's {}, not doing anything, 
beforeObj.getObjectClass());
+LOG.debug(Not about user, or role mapping missing for