syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [2/3] syncope git commit: [SYNCOPE-1354] Taking always enable into account when creating Propagation Tasks upon Push
Date Mon, 13 Aug 2018 13:36:14 GMT
[SYNCOPE-1354] Taking always enable into account when creating Propagation Tasks upon Push


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/fa27b90c
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/fa27b90c
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/fa27b90c

Branch: refs/heads/master
Commit: fa27b90c5d180d27fcea60020ca55f729dab2b9e
Parents: 7edc502
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Mon Aug 13 15:13:03 2018 +0200
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Mon Aug 13 15:13:12 2018 +0200

----------------------------------------------------------------------
 .../api/propagation/PropagationManager.java     |  2 ++
 .../DefaultAnyObjectProvisioningManager.java    |  1 +
 .../java/DefaultGroupProvisioningManager.java   |  2 ++
 .../propagation/PropagationManagerImpl.java     |  3 ++-
 .../pushpull/AbstractPushResultHandler.java     | 22 ++++++++++++--------
 .../camel/producer/CreateProducer.java          |  2 ++
 6 files changed, 22 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/fa27b90c/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationManager.java
b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationManager.java
index 6994a47..00c311b 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationManager.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationManager.java
@@ -36,6 +36,7 @@ public interface PropagationManager {
      *
      * @param kind any object type kind
      * @param key any object key
+     * @param enable whether any object should be enabled or not
      * @param propByRes operation to be performed per resource
      * @param vAttrs virtual attributes to be set
      * @param noPropResourceKeys external resources performing not to be considered for propagation
@@ -44,6 +45,7 @@ public interface PropagationManager {
     List<PropagationTaskTO> getCreateTasks(
             AnyTypeKind kind,
             String key,
+            Boolean enable,
             PropagationByResource propByRes,
             Collection<AttrTO> vAttrs,
             Collection<String> noPropResourceKeys);

http://git-wip-us.apache.org/repos/asf/syncope/blob/fa27b90c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultAnyObjectProvisioningManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultAnyObjectProvisioningManager.java
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultAnyObjectProvisioningManager.java
index bffc136..29447d5 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultAnyObjectProvisioningManager.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultAnyObjectProvisioningManager.java
@@ -78,6 +78,7 @@ public class DefaultAnyObjectProvisioningManager implements AnyObjectProvisionin
         List<PropagationTaskTO> tasks = propagationManager.getCreateTasks(
                 AnyTypeKind.ANY_OBJECT,
                 created.getResult(),
+                null,
                 created.getPropByRes(),
                 anyObjectTO.getVirAttrs(),
                 excludedResources);

http://git-wip-us.apache.org/repos/asf/syncope/blob/fa27b90c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultGroupProvisioningManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultGroupProvisioningManager.java
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultGroupProvisioningManager.java
index 98aab4d..5ca7d23 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultGroupProvisioningManager.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultGroupProvisioningManager.java
@@ -74,6 +74,7 @@ public class DefaultGroupProvisioningManager implements GroupProvisioningManager
         List<PropagationTaskTO> tasks = propagationManager.getCreateTasks(
                 AnyTypeKind.GROUP,
                 created.getResult(),
+                null,
                 created.getPropByRes(),
                 groupTO.getVirAttrs(),
                 Collections.<String>emptySet());
@@ -99,6 +100,7 @@ public class DefaultGroupProvisioningManager implements GroupProvisioningManager
         List<PropagationTaskTO> tasks = propagationManager.getCreateTasks(
                 AnyTypeKind.GROUP,
                 created.getResult(),
+                null,
                 created.getPropByRes(),
                 groupTO.getVirAttrs(),
                 excludedResources);

http://git-wip-us.apache.org/repos/asf/syncope/blob/fa27b90c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java
index 7f4e06c..deac6a4 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java
@@ -136,11 +136,12 @@ public class PropagationManagerImpl implements PropagationManager {
     public List<PropagationTaskTO> getCreateTasks(
             final AnyTypeKind kind,
             final String key,
+            final Boolean enable,
             final PropagationByResource propByRes,
             final Collection<AttrTO> vAttrs,
             final Collection<String> noPropResourceKeys) {
 
-        return getCreateTasks(dao(kind).authFind(key), null, null, propByRes, vAttrs, noPropResourceKeys);
+        return getCreateTasks(dao(kind).authFind(key), null, enable, propByRes, vAttrs, noPropResourceKeys);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/fa27b90c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPushResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPushResultHandler.java
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPushResultHandler.java
index 4d42271..1053c02 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPushResultHandler.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPushResultHandler.java
@@ -90,7 +90,12 @@ public abstract class AbstractPushResultHandler extends AbstractSyncopeResultHan
         }
     }
 
-    protected void update(final Any<?> any, final ConnectorObject beforeObj, final
ProvisioningReport result) {
+    protected void update(
+            final Any<?> any,
+            final Boolean enable,
+            final ConnectorObject beforeObj,
+            final ProvisioningReport result) {
+
         boolean changepwd = any instanceof User;
         List<String> ownedResources = getAnyUtils().getAllResources(any).stream().
                 map(Entity::getKey).collect(Collectors.toList());
@@ -106,7 +111,7 @@ public abstract class AbstractPushResultHandler extends AbstractSyncopeResultHan
                 any.getType().getKind(),
                 any.getKey(),
                 changepwd,
-                null,
+                enable,
                 propByRes,
                 null,
                 noPropResources),
@@ -133,7 +138,7 @@ public abstract class AbstractPushResultHandler extends AbstractSyncopeResultHan
         reportPropagation(result, reporter);
     }
 
-    protected void provision(final Any<?> any, final Boolean enabled, final ProvisioningReport
result) {
+    protected void provision(final Any<?> any, final Boolean enable, final ProvisioningReport
result) {
         AnyTO before = getAnyTO(any.getKey());
 
         List<String> noPropResources = new ArrayList<>(before.getResources());
@@ -145,6 +150,7 @@ public abstract class AbstractPushResultHandler extends AbstractSyncopeResultHan
         PropagationReporter reporter = taskExecutor.execute(propagationManager.getCreateTasks(
                 any.getType().getKind(),
                 any.getKey(),
+                enable,
                 propByRes,
                 before.getVirAttrs(),
                 noPropResources),
@@ -260,14 +266,12 @@ public abstract class AbstractPushResultHandler extends AbstractSyncopeResultHan
         Object output = null;
         Result resultStatus = null;
 
-        Boolean enabled = any instanceof User && profile.getTask().isSyncStatus()
+        Boolean enable = any instanceof User && profile.getTask().isSyncStatus()
                 ? ((User) any).isSuspended()
                 ? Boolean.FALSE
                 : Boolean.TRUE
                 : null;
 
-        Boolean status = profile.getTask().isSyncStatus() ? enabled : null;
-
         if (profile.isDryRun()) {
             if (beforeObj == null) {
                 result.setOperation(toResourceOperation(profile.getTask().getUnmatchingRule()));
@@ -304,7 +308,7 @@ public abstract class AbstractPushResultHandler extends AbstractSyncopeResultHan
                                 LOG.debug("PushTask not configured for create");
                                 result.setStatus(ProvisioningReport.Status.IGNORE);
                             } else {
-                                assign(any, status, result);
+                                assign(any, enable, result);
                             }
                             break;
 
@@ -317,7 +321,7 @@ public abstract class AbstractPushResultHandler extends AbstractSyncopeResultHan
                                 LOG.debug("PushTask not configured for create");
                                 result.setStatus(ProvisioningReport.Status.IGNORE);
                             } else {
-                                provision(any, status, result);
+                                provision(any, enable, result);
                             }
                             break;
 
@@ -354,7 +358,7 @@ public abstract class AbstractPushResultHandler extends AbstractSyncopeResultHan
                                 LOG.debug("PushTask not configured for update");
                                 result.setStatus(ProvisioningReport.Status.IGNORE);
                             } else {
-                                update(any, beforeObj, result);
+                                update(any, enable, beforeObj, result);
                             }
                             break;
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/fa27b90c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/CreateProducer.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/CreateProducer.java
b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/CreateProducer.java
index c18f7a0..27ab612 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/CreateProducer.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/CreateProducer.java
@@ -76,6 +76,7 @@ public class CreateProducer extends AbstractProducer {
                     List<PropagationTaskTO> tasks = getPropagationManager().getCreateTasks(
                             AnyTypeKind.GROUP,
                             created.getResult(),
+                            null,
                             created.getPropByRes(),
                             ((AnyTO) actual).getVirAttrs(),
                             excludedResources);
@@ -86,6 +87,7 @@ public class CreateProducer extends AbstractProducer {
                     List<PropagationTaskTO> tasks = getPropagationManager().getCreateTasks(
                             actual instanceof AnyObjectTO ? AnyTypeKind.ANY_OBJECT : AnyTypeKind.GROUP,
                             created.getResult(),
+                            null,
                             created.getPropByRes(),
                             ((AnyTO) actual).getVirAttrs(),
                             excludedResources);


Mime
View raw message