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 2017/01/31 16:31:25 UTC

[2/6] syncope git commit: [SYNCOPE-1004] Now managing selfRead() too

[SYNCOPE-1004] Now managing selfRead() too


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

Branch: refs/heads/2_0_X
Commit: c3458e4a8929329e97fe8eba8c72dcafb61ba948
Parents: 9707b20
Author: Francesco Chicchiricc� <il...@apache.org>
Authored: Tue Jan 31 17:25:22 2017 +0100
Committer: Francesco Chicchiricc� <il...@apache.org>
Committed: Tue Jan 31 17:25:22 2017 +0100

----------------------------------------------------------------------
 .../src/main/java/org/apache/syncope/core/logic/UserLogic.java  | 2 +-
 .../provisioning/java/notification/NotificationManagerImpl.java | 5 +++++
 .../syncope/core/rest/cxf/service/UserSelfServiceImpl.java      | 4 ++--
 .../src/test/java/org/apache/syncope/fit/core/ReportITCase.java | 2 +-
 4 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/c3458e4a/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
index b5a41da..f51fdb6 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
@@ -115,7 +115,7 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch> {
 
     @PreAuthorize("isAuthenticated()")
     @Transactional(readOnly = true)
-    public Pair<String, UserTO> readSelf() {
+    public Pair<String, UserTO> selfRead() {
         return ImmutablePair.of(
                 POJOHelper.serialize(AuthContextUtils.getAuthorizations()),
                 binder.returnUserTO(binder.getAuthenticatedUserTO()));

http://git-wip-us.apache.org/repos/asf/syncope/blob/c3458e4a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
index 6248185..1a021ae 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
@@ -28,6 +28,7 @@ import java.util.Map;
 import java.util.Set;
 import org.apache.commons.jexl3.MapContext;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
 import org.apache.syncope.common.lib.to.GroupTO;
 import org.apache.syncope.common.lib.to.UserTO;
 import org.apache.syncope.common.lib.types.AuditElements;
@@ -270,6 +271,10 @@ public class NotificationManagerImpl implements NotificationManager {
             any = userDAO.find(((UserTO) before).getKey());
         } else if (output instanceof UserTO) {
             any = userDAO.find(((UserTO) output).getKey());
+        } else if (output instanceof Pair
+                && ((Pair) output).getRight() instanceof UserTO) {
+
+            any = userDAO.find(((UserTO) ((Pair) output).getRight()).getKey());
         } else if (output instanceof ProvisioningResult
                 && ((ProvisioningResult) output).getEntity() instanceof UserTO) {
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/c3458e4a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserSelfServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserSelfServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserSelfServiceImpl.java
index 3ccfd82..c76986e 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserSelfServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserSelfServiceImpl.java
@@ -56,7 +56,7 @@ public class UserSelfServiceImpl extends AbstractServiceImpl implements UserSelf
 
     @Override
     public Response read() {
-        Pair<String, UserTO> self = logic.readSelf();
+        Pair<String, UserTO> self = logic.selfRead();
         return Response.ok().
                 header(RESTHeaders.RESOURCE_KEY, self.getValue().getKey()).
                 header(RESTHeaders.OWNED_ENTITLEMENTS, self.getKey()).
@@ -72,7 +72,7 @@ public class UserSelfServiceImpl extends AbstractServiceImpl implements UserSelf
 
     @Override
     public Response update(final UserTO user) {
-        Pair<String, UserTO> self = logic.readSelf();
+        Pair<String, UserTO> self = logic.selfRead();
         return update(AnyOperations.diff(user, self.getValue(), false));
     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/c3458e4a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java
index 4dc4663..57ba47e 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java
@@ -257,7 +257,7 @@ public class ReportITCase extends AbstractITCase {
                 AuditElements.EventCategoryType.LOGIC,
                 "UserLogic",
                 null,
-                "readSelf",
+                "selfRead",
                 AuditElements.Result.SUCCESS);
 
         try {