This is an automated email from the ASF dual-hosted git repository.

shuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/unomi.git


The following commit(s) were added to refs/heads/master by this push:
     new 0ea1aba  UNOMI-299 Fix issue with revoking consents that use scopes
0ea1aba is described below

commit 0ea1aba39c65d86323a8c5dd5d2aab989f4079d7
Author: Serge Huber <[email protected]>
AuthorDate: Tue Apr 21 21:36:59 2020 +0200

    UNOMI-299 Fix issue with revoking consents that use scopes
---
 api/src/main/java/org/apache/unomi/api/Profile.java | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/api/src/main/java/org/apache/unomi/api/Profile.java 
b/api/src/main/java/org/apache/unomi/api/Profile.java
index 90a3a90..ba75da9 100644
--- a/api/src/main/java/org/apache/unomi/api/Profile.java
+++ b/api/src/main/java/org/apache/unomi/api/Profile.java
@@ -237,9 +237,16 @@ public class Profile extends Item {
     @XmlTransient
     public boolean setConsent(Consent consent) {
         if (ConsentStatus.REVOKED.equals(consent.getStatus())) {
-            if (consents.containsKey(consent.getTypeIdentifier())) {
-                consents.remove(consent.getTypeIdentifier());
-                return true;
+            if (consent.getScope() != null) {
+                if (consents.containsKey(consent.getScope() + "/" + 
consent.getTypeIdentifier())) {
+                    consents.remove(consent.getScope() + "/" + 
consent.getTypeIdentifier());
+                    return true;
+                }
+            } else {
+                if (consents.containsKey(consent.getTypeIdentifier())) {
+                    consents.remove(consent.getTypeIdentifier());
+                    return true;
+                }
             }
             return false;
         }

Reply via email to