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 2015/11/25 16:00:53 UTC

[1/2] syncope git commit: Upgrading awesome

Repository: syncope
Updated Branches:
  refs/heads/master 84040d6df -> 59106ffc7


Upgrading awesome


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

Branch: refs/heads/master
Commit: 4fd76bf663666082150da4b79fd88f1c920d93ab
Parents: 84040d6
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Wed Nov 25 16:00:21 2015 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Wed Nov 25 16:00:21 2015 +0100

----------------------------------------------------------------------
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/4fd76bf6/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 1b4384a..f1fdcd9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -381,7 +381,7 @@ under the License.
     <wicket-bootstrap.version>0.10.4</wicket-bootstrap.version>
     <bootbox.version>4.4.0</bootbox.version>
 
-    <font-awesome.version>4.4.0</font-awesome.version>
+    <font-awesome.version>4.5.0</font-awesome.version>
     <ionicons.version>2.0.1</ionicons.version>
     <highlightjs.version>8.7</highlightjs.version>
     <codemirror.version>5.8</codemirror.version>


[2/2] syncope git commit: [SYNCOPE-119] Avoid duplicate realm specification in assignable queries

Posted by il...@apache.org.
[SYNCOPE-119] Avoid duplicate realm specification in assignable queries


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

Branch: refs/heads/master
Commit: 59106ffc72dcfb0d7c103c7636770ba246d2bd0b
Parents: 4fd76bf
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Wed Nov 25 16:00:44 2015 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Wed Nov 25 16:00:44 2015 +0100

----------------------------------------------------------------------
 .../commands/user/UserSyncopeOperations.java    |  6 +--
 .../AnyObjectFiqlSearchConditionBuilder.java    |  8 ++--
 .../common/lib/search/AnyObjectProperty.java    |  2 +-
 .../search/GroupFiqlSearchConditionBuilder.java |  8 ++--
 .../common/lib/search/GroupProperty.java        |  2 +-
 .../common/rest/api/beans/AnyListQuery.java     | 18 +++------
 .../common/rest/api/beans/AnySearchQuery.java   |  7 +---
 .../syncope/core/logic/AbstractAnyLogic.java    | 13 ++++---
 .../syncope/core/logic/AnyObjectLogic.java      | 31 ++++++++--------
 .../apache/syncope/core/logic/GroupLogic.java   | 38 +++++++++----------
 .../apache/syncope/core/logic/UserLogic.java    | 39 +++++++++-----------
 .../core/misc/search/SearchCondConverter.java   |  6 ++-
 .../core/misc/search/SearchCondVisitor.java     |  9 +++--
 .../misc/search/SearchCondConverterTest.java    |  6 +--
 .../rest/cxf/service/AbstractAnyService.java    | 30 +++++----------
 .../rest/cxf/service/AbstractServiceImpl.java   |  3 +-
 .../rest/cxf/service/AnyObjectServiceImpl.java  |  2 +-
 .../fit/core/reference/SearchITCase.java        | 12 +++---
 18 files changed, 107 insertions(+), 133 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/59106ffc/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSyncopeOperations.java
index 9cdabd7..80ae127 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSyncopeOperations.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSyncopeOperations.java
@@ -18,7 +18,6 @@
  */
 package org.apache.syncope.client.cli.commands.user;
 
-import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 import org.apache.syncope.client.cli.SyncopeServices;
@@ -96,10 +95,7 @@ public class UserSyncopeOperations {
     }
 
     public Map<String, BulkActionResult.Status> deleteAll(final String realm) {
-        final AnyListQuery anyListQuery = new AnyListQuery();
-        anyListQuery.setDetails(false);
-        anyListQuery.setRealms(Arrays.asList(realm));
-        return deleteBulk(userService.list(anyListQuery).getResult());
+        return deleteBulk(userService.list(new AnyListQuery.Builder().realm(realm).details(false).build()).getResult());
     }
 
     private Map<String, BulkActionResult.Status> deleteBulk(final List<UserTO> users) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/59106ffc/common/lib/src/main/java/org/apache/syncope/common/lib/search/AnyObjectFiqlSearchConditionBuilder.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/search/AnyObjectFiqlSearchConditionBuilder.java b/common/lib/src/main/java/org/apache/syncope/common/lib/search/AnyObjectFiqlSearchConditionBuilder.java
index 0841de3..a84d9ad 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/search/AnyObjectFiqlSearchConditionBuilder.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/search/AnyObjectFiqlSearchConditionBuilder.java
@@ -89,10 +89,10 @@ public class AnyObjectFiqlSearchConditionBuilder extends AbstractFiqlSearchCondi
                 notInRelationshipTypes(type, moreTypes);
     }
 
-    public CompleteCondition isAssignable(final String realm, final String... moreRealms) {
+    public CompleteCondition isAssignable() {
         return newBuilderInstance().
                 is(SpecialAttr.ASSIGNABLE.toString()).
-                isAssignable(realm, moreRealms);
+                isAssignable();
     }
 
     protected class Builder extends AbstractFiqlSearchConditionBuilder.Builder
@@ -156,9 +156,9 @@ public class AnyObjectFiqlSearchConditionBuilder extends AbstractFiqlSearchCondi
         }
 
         @Override
-        public CompleteCondition isAssignable(final String realm, final String... moreRealms) {
+        public CompleteCondition isAssignable() {
             this.result = SpecialAttr.ASSIGNABLE.toString();
-            return condition(FiqlParser.EQ, realm, (Object[]) moreRealms);
+            return condition(FiqlParser.EQ, SpecialAttr.NULL);
         }
 
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/59106ffc/common/lib/src/main/java/org/apache/syncope/common/lib/search/AnyObjectProperty.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/search/AnyObjectProperty.java b/common/lib/src/main/java/org/apache/syncope/common/lib/search/AnyObjectProperty.java
index 47de383..55815ea 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/search/AnyObjectProperty.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/search/AnyObjectProperty.java
@@ -34,6 +34,6 @@ public interface AnyObjectProperty extends SyncopeProperty {
 
     CompleteCondition notInRelationshipTypes(String type, String... moreTypes);
 
-    CompleteCondition isAssignable(String realm, String... moreRealms);
+    CompleteCondition isAssignable();
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/59106ffc/common/lib/src/main/java/org/apache/syncope/common/lib/search/GroupFiqlSearchConditionBuilder.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/search/GroupFiqlSearchConditionBuilder.java b/common/lib/src/main/java/org/apache/syncope/common/lib/search/GroupFiqlSearchConditionBuilder.java
index 9a2bc3f..af0364b 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/search/GroupFiqlSearchConditionBuilder.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/search/GroupFiqlSearchConditionBuilder.java
@@ -38,10 +38,10 @@ public class GroupFiqlSearchConditionBuilder extends AbstractFiqlSearchCondition
         return newBuilderInstance().is(property);
     }
 
-    public CompleteCondition isAssignable(final String realm, final String... moreRealms) {
+    public CompleteCondition isAssignable() {
         return newBuilderInstance().
                 is(SpecialAttr.ASSIGNABLE.toString()).
-                isAssignable(realm, moreRealms);
+                isAssignable();
     }
 
     protected static class Builder extends AbstractFiqlSearchConditionBuilder.Builder
@@ -63,9 +63,9 @@ public class GroupFiqlSearchConditionBuilder extends AbstractFiqlSearchCondition
         }
 
         @Override
-        public CompleteCondition isAssignable(final String realm, final String... moreRealms) {
+        public CompleteCondition isAssignable() {
             this.result = SpecialAttr.ASSIGNABLE.toString();
-            return condition(FiqlParser.EQ, realm, (Object[]) moreRealms);
+            return condition(FiqlParser.EQ, SpecialAttr.NULL);
         }
 
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/59106ffc/common/lib/src/main/java/org/apache/syncope/common/lib/search/GroupProperty.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/search/GroupProperty.java b/common/lib/src/main/java/org/apache/syncope/common/lib/search/GroupProperty.java
index 8dc375e..672bac0 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/search/GroupProperty.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/search/GroupProperty.java
@@ -22,6 +22,6 @@ import org.apache.cxf.jaxrs.ext.search.client.CompleteCondition;
 
 public interface GroupProperty extends SyncopeProperty {
 
-    CompleteCondition isAssignable(String realm, String... moreRealms);
+    CompleteCondition isAssignable();
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/59106ffc/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnyListQuery.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnyListQuery.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnyListQuery.java
index a763c21..cc394c0 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnyListQuery.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnyListQuery.java
@@ -18,8 +18,6 @@
  */
 package org.apache.syncope.common.rest.api.beans;
 
-import java.util.ArrayList;
-import java.util.List;
 import javax.ws.rs.DefaultValue;
 import javax.ws.rs.MatrixParam;
 import org.apache.syncope.common.lib.SyncopeConstants;
@@ -41,24 +39,20 @@ public class AnyListQuery extends AnyQuery {
         }
 
         public Builder realm(final String realm) {
-            if (getInstance().getRealms() == null) {
-                getInstance().setRealms(new ArrayList<String>());
-            }
-            getInstance().getRealms().add(realm);
-
+            getInstance().setRealm(realm);
             return this;
         }
     }
 
-    private List<String> realms;
+    private String realm;
 
-    public List<String> getRealms() {
-        return realms;
+    public String getRealm() {
+        return realm;
     }
 
     @DefaultValue(SyncopeConstants.ROOT_REALM)
     @MatrixParam("realm")
-    public void setRealms(final List<String> realms) {
-        this.realms = realms;
+    public void setRealm(final String realm) {
+        this.realm = realm;
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/59106ffc/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnySearchQuery.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnySearchQuery.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnySearchQuery.java
index dca93cf..ae38801 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnySearchQuery.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnySearchQuery.java
@@ -18,7 +18,6 @@
  */
 package org.apache.syncope.common.rest.api.beans;
 
-import java.util.ArrayList;
 import javax.ws.rs.QueryParam;
 import org.apache.syncope.common.rest.api.service.JAXRSService;
 
@@ -39,11 +38,7 @@ public class AnySearchQuery extends AnyListQuery {
         }
 
         public Builder realm(final String realm) {
-            if (getInstance().getRealms() == null) {
-                getInstance().setRealms(new ArrayList<String>());
-            }
-            getInstance().getRealms().add(realm);
-
+            getInstance().setRealm(realm);
             return this;
         }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/59106ffc/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractAnyLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractAnyLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractAnyLogic.java
index 987595d..18b9429 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractAnyLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractAnyLogic.java
@@ -191,10 +191,11 @@ public abstract class AbstractAnyLogic<TO extends AnyTO, P extends AnyPatch>
     }
 
     protected Set<String> getEffectiveRealms(
-            final Set<String> allowedRealms, final Collection<String> requestedRealms) {
+            final Set<String> allowedRealms, final String requestedRealm) {
 
         Set<String> allowed = RealmUtils.normalize(allowedRealms);
-        Set<String> requested = RealmUtils.normalize(requestedRealms);
+        Set<String> requested = new HashSet<>();
+        requested.add(requestedRealm);
 
         Set<String> effective = new HashSet<>();
         CollectionUtils.select(requested, new StartsWithPredicate(allowed), effective);
@@ -224,7 +225,7 @@ public abstract class AbstractAnyLogic<TO extends AnyTO, P extends AnyPatch>
 
     public abstract TO read(Long key);
 
-    public abstract int count(List<String> realms);
+    public abstract int count(String realm);
 
     public abstract ProvisioningResult<TO> create(TO anyTO, boolean nullPriorityAsync);
 
@@ -234,14 +235,14 @@ public abstract class AbstractAnyLogic<TO extends AnyTO, P extends AnyPatch>
 
     public abstract List<TO> list(
             int page, int size, List<OrderByClause> orderBy,
-            List<String> realms,
+            String realm,
             boolean details);
 
     public abstract List<TO> search(
             SearchCond searchCondition,
             int page, int size, List<OrderByClause> orderBy,
-            List<String> realms,
+            String realm,
             boolean details);
 
-    public abstract int searchCount(SearchCond searchCondition, List<String> realms);
+    public abstract int searchCount(SearchCond searchCondition, String realm);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/59106ffc/core/logic/src/main/java/org/apache/syncope/core/logic/AnyObjectLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/AnyObjectLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/AnyObjectLogic.java
index 99dc2f5..cca89c3 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/AnyObjectLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/AnyObjectLogic.java
@@ -21,7 +21,6 @@ package org.apache.syncope.core.logic;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 import java.util.Set;
 import org.apache.commons.collections4.CollectionUtils;
@@ -80,7 +79,7 @@ public class AnyObjectLogic extends AbstractAnyLogic<AnyObjectTO, AnyObjectPatch
 
     @Transactional(readOnly = true)
     @Override
-    public int count(final List<String> realms) {
+    public int count(final String realm) {
         throw new UnsupportedOperationException("Need to specify " + AnyType.class.getSimpleName());
     }
 
@@ -88,14 +87,14 @@ public class AnyObjectLogic extends AbstractAnyLogic<AnyObjectTO, AnyObjectPatch
     @Override
     public List<AnyObjectTO> list(
             final int page, final int size, final List<OrderByClause> orderBy,
-            final List<String> realms, final boolean details) {
+            final String realm, final boolean details) {
 
         throw new UnsupportedOperationException("Need to specify " + AnyType.class.getSimpleName());
     }
 
     @Transactional(readOnly = true)
     @Override
-    public int searchCount(final SearchCond searchCond, final List<String> realms) {
+    public int searchCount(final SearchCond searchCond, final String realm) {
         if (searchCond.hasAnyTypeCond() == null) {
             throw new UnsupportedOperationException("Need to specify " + AnyType.class.getSimpleName());
         }
@@ -103,7 +102,7 @@ public class AnyObjectLogic extends AbstractAnyLogic<AnyObjectTO, AnyObjectPatch
         Set<String> effectiveRealms = getEffectiveRealms(
                 AuthContextUtils.getAuthorizations().get(EntitlementsHolder.getInstance().
                         getFor(searchCond.hasAnyTypeCond(), EntitlementsHolder.AnyEntitlement.SEARCH)),
-                realms);
+                realm);
 
         return searchDAO.count(effectiveRealms, searchCond, AnyTypeKind.ANY_OBJECT);
     }
@@ -111,7 +110,7 @@ public class AnyObjectLogic extends AbstractAnyLogic<AnyObjectTO, AnyObjectPatch
     @Transactional(readOnly = true)
     @Override
     public List<AnyObjectTO> search(final SearchCond searchCond, final int page, final int size,
-            final List<OrderByClause> orderBy, final List<String> realms, final boolean details) {
+            final List<OrderByClause> orderBy, final String realm, final boolean details) {
 
         if (searchCond.hasAnyTypeCond() == null) {
             throw new UnsupportedOperationException("Need to specify " + AnyType.class.getSimpleName());
@@ -120,7 +119,7 @@ public class AnyObjectLogic extends AbstractAnyLogic<AnyObjectTO, AnyObjectPatch
         Set<String> effectiveRealms = getEffectiveRealms(
                 AuthContextUtils.getAuthorizations().get(EntitlementsHolder.getInstance().
                         getFor(searchCond.hasAnyTypeCond(), EntitlementsHolder.AnyEntitlement.SEARCH)),
-                realms);
+                realm);
 
         List<AnyObject> matchingAnyObjects = searchDAO.search(
                 effectiveRealms, searchCond, page, size, orderBy, AnyTypeKind.ANY_OBJECT);
@@ -147,7 +146,7 @@ public class AnyObjectLogic extends AbstractAnyLogic<AnyObjectTO, AnyObjectPatch
         Set<String> effectiveRealms = getEffectiveRealms(
                 AuthContextUtils.getAuthorizations().get(EntitlementsHolder.getInstance().
                         getFor(before.getLeft().getType(), EntitlementsHolder.AnyEntitlement.CREATE)),
-                Collections.singleton(before.getLeft().getRealm()));
+                before.getLeft().getRealm());
         securityChecks(effectiveRealms, before.getLeft().getRealm(), null);
 
         Pair<Long, List<PropagationStatus>> created = provisioningManager.create(before.getLeft(), nullPriorityAsync);
@@ -169,7 +168,7 @@ public class AnyObjectLogic extends AbstractAnyLogic<AnyObjectTO, AnyObjectPatch
         Set<String> effectiveRealms = getEffectiveRealms(
                 AuthContextUtils.getAuthorizations().get(EntitlementsHolder.getInstance().
                         getFor(anyObjectTO.getType(), EntitlementsHolder.AnyEntitlement.UPDATE)),
-                Collections.singleton(realm));
+                realm);
         securityChecks(effectiveRealms, realm, before.getLeft().getKey());
 
         Pair<Long, List<PropagationStatus>> updated = provisioningManager.update(anyObjectPatch, nullPriorityAsync);
@@ -185,7 +184,7 @@ public class AnyObjectLogic extends AbstractAnyLogic<AnyObjectTO, AnyObjectPatch
         Set<String> effectiveRealms = getEffectiveRealms(
                 AuthContextUtils.getAuthorizations().get(EntitlementsHolder.getInstance().
                         getFor(before.getLeft().getType(), EntitlementsHolder.AnyEntitlement.DELETE)),
-                Collections.singleton(before.getLeft().getRealm()));
+                before.getLeft().getRealm());
         securityChecks(effectiveRealms, before.getLeft().getRealm(), before.getLeft().getKey());
 
         List<PropagationStatus> statuses = provisioningManager.delete(before.getLeft().getKey(), nullPriorityAsync);
@@ -203,7 +202,7 @@ public class AnyObjectLogic extends AbstractAnyLogic<AnyObjectTO, AnyObjectPatch
         Set<String> effectiveRealms = getEffectiveRealms(
                 AuthContextUtils.getAuthorizations().get(EntitlementsHolder.getInstance().
                         getFor(anyObject.getType(), EntitlementsHolder.AnyEntitlement.UPDATE)),
-                Collections.singleton(anyObject.getRealm()));
+                anyObject.getRealm());
         securityChecks(effectiveRealms, anyObject.getRealm(), anyObject.getKey());
 
         AnyObjectPatch patch = new AnyObjectPatch();
@@ -226,7 +225,7 @@ public class AnyObjectLogic extends AbstractAnyLogic<AnyObjectTO, AnyObjectPatch
         Set<String> effectiveRealms = getEffectiveRealms(
                 AuthContextUtils.getAuthorizations().get(EntitlementsHolder.getInstance().
                         getFor(anyObject.getType(), EntitlementsHolder.AnyEntitlement.UPDATE)),
-                Collections.singleton(anyObject.getRealm()));
+                anyObject.getRealm());
         securityChecks(effectiveRealms, anyObject.getRealm(), anyObject.getKey());
 
         AnyObjectPatch patch = new AnyObjectPatch();
@@ -251,7 +250,7 @@ public class AnyObjectLogic extends AbstractAnyLogic<AnyObjectTO, AnyObjectPatch
         Set<String> effectiveRealms = getEffectiveRealms(
                 AuthContextUtils.getAuthorizations().get(EntitlementsHolder.getInstance().
                         getFor(anyObject.getType(), EntitlementsHolder.AnyEntitlement.UPDATE)),
-                Collections.singleton(anyObject.getRealm()));
+                anyObject.getRealm());
         securityChecks(effectiveRealms, anyObject.getRealm(), anyObject.getKey());
 
         AnyObjectPatch patch = new AnyObjectPatch();
@@ -280,7 +279,7 @@ public class AnyObjectLogic extends AbstractAnyLogic<AnyObjectTO, AnyObjectPatch
         Set<String> effectiveRealms = getEffectiveRealms(
                 AuthContextUtils.getAuthorizations().get(EntitlementsHolder.getInstance().
                         getFor(anyObject.getType(), EntitlementsHolder.AnyEntitlement.UPDATE)),
-                Collections.singleton(anyObject.getRealm()));
+                anyObject.getRealm());
         securityChecks(effectiveRealms, anyObject.getRealm(), anyObject.getKey());
 
         AnyObjectPatch patch = new AnyObjectPatch();
@@ -305,7 +304,7 @@ public class AnyObjectLogic extends AbstractAnyLogic<AnyObjectTO, AnyObjectPatch
         Set<String> effectiveRealms = getEffectiveRealms(
                 AuthContextUtils.getAuthorizations().get(EntitlementsHolder.getInstance().
                         getFor(anyObject.getType(), EntitlementsHolder.AnyEntitlement.UPDATE)),
-                Collections.singleton(anyObject.getRealm()));
+                anyObject.getRealm());
         securityChecks(effectiveRealms, anyObject.getRealm(), anyObject.getKey());
 
         List<PropagationStatus> statuses = provisioningManager.deprovision(key, resources, nullPriorityAsync);
@@ -329,7 +328,7 @@ public class AnyObjectLogic extends AbstractAnyLogic<AnyObjectTO, AnyObjectPatch
         Set<String> effectiveRealms = getEffectiveRealms(
                 AuthContextUtils.getAuthorizations().get(EntitlementsHolder.getInstance().
                         getFor(anyObject.getType(), EntitlementsHolder.AnyEntitlement.UPDATE)),
-                Collections.singleton(anyObject.getRealm()));
+                anyObject.getRealm());
         securityChecks(effectiveRealms, anyObject.getRealm(), anyObject.getKey());
 
         List<PropagationStatus> statuses = provisioningManager.provision(key, resources, nullPriorityAsync);

http://git-wip-us.apache.org/repos/asf/syncope/blob/59106ffc/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
index d24b678..65b9a25 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
@@ -21,8 +21,6 @@ package org.apache.syncope.core.logic;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import org.apache.commons.collections4.CollectionUtils;
@@ -119,8 +117,8 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO, GroupPatch> {
     @PreAuthorize("isAuthenticated()")
     @Transactional(readOnly = true)
     @Override
-    public int count(final List<String> realms) {
-        return groupDAO.count(getEffectiveRealms(SyncopeConstants.FULL_ADMIN_REALMS, realms));
+    public int count(final String realm) {
+        return groupDAO.count(getEffectiveRealms(SyncopeConstants.FULL_ADMIN_REALMS, realm));
     }
 
     @PreAuthorize("isAuthenticated()")
@@ -128,10 +126,10 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO, GroupPatch> {
     @Override
     public List<GroupTO> list(
             final int page, final int size, final List<OrderByClause> orderBy,
-            final List<String> realms, final boolean details) {
+            final String realm, final boolean details) {
 
         return CollectionUtils.collect(groupDAO.findAll(
-                getEffectiveRealms(SyncopeConstants.FULL_ADMIN_REALMS, realms),
+                getEffectiveRealms(SyncopeConstants.FULL_ADMIN_REALMS, realm),
                 page, size, orderBy),
                 new Transformer<Group, GroupTO>() {
 
@@ -145,9 +143,9 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO, GroupPatch> {
     @PreAuthorize("hasRole('" + StandardEntitlement.GROUP_SEARCH + "')")
     @Transactional(readOnly = true)
     @Override
-    public int searchCount(final SearchCond searchCondition, final List<String> realms) {
+    public int searchCount(final SearchCond searchCondition, final String realm) {
         return searchDAO.count(
-                getEffectiveRealms(AuthContextUtils.getAuthorizations().get(StandardEntitlement.GROUP_SEARCH), realms),
+                getEffectiveRealms(AuthContextUtils.getAuthorizations().get(StandardEntitlement.GROUP_SEARCH), realm),
                 searchCondition, AnyTypeKind.GROUP);
     }
 
@@ -155,10 +153,10 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO, GroupPatch> {
     @Transactional(readOnly = true)
     @Override
     public List<GroupTO> search(final SearchCond searchCondition, final int page, final int size,
-            final List<OrderByClause> orderBy, final List<String> realms, final boolean details) {
+            final List<OrderByClause> orderBy, final String realm, final boolean details) {
 
         List<Group> matchingGroups = searchDAO.search(
-                getEffectiveRealms(AuthContextUtils.getAuthorizations().get(StandardEntitlement.GROUP_SEARCH), realms),
+                getEffectiveRealms(AuthContextUtils.getAuthorizations().get(StandardEntitlement.GROUP_SEARCH), realm),
                 searchCondition, page, size, orderBy, AnyTypeKind.GROUP);
         return CollectionUtils.collect(matchingGroups, new Transformer<Group, GroupTO>() {
 
@@ -180,7 +178,7 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO, GroupPatch> {
 
         Set<String> effectiveRealms = getEffectiveRealms(
                 AuthContextUtils.getAuthorizations().get(StandardEntitlement.GROUP_CREATE),
-                Collections.singleton(before.getLeft().getRealm()));
+                before.getLeft().getRealm());
         securityChecks(effectiveRealms, before.getLeft().getRealm(), null);
 
         Pair<Long, List<PropagationStatus>> created =
@@ -196,11 +194,9 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO, GroupPatch> {
         Pair<GroupPatch, List<LogicActions>> before = beforeUpdate(groupPatch, groupTO.getRealm());
 
         if (before.getLeft().getRealm() != null && StringUtils.isNotBlank(before.getLeft().getRealm().getValue())) {
-            Set<String> requestedRealms = new HashSet<>();
-            requestedRealms.add(before.getLeft().getRealm().getValue());
             Set<String> effectiveRealms = getEffectiveRealms(
                     AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_UPDATE),
-                    requestedRealms);
+                    before.getLeft().getRealm().getValue());
             securityChecks(effectiveRealms, before.getLeft().getRealm().getValue(), before.getLeft().getKey());
         }
 
@@ -217,7 +213,7 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO, GroupPatch> {
 
         Set<String> effectiveRealms = getEffectiveRealms(
                 AuthContextUtils.getAuthorizations().get(StandardEntitlement.GROUP_DELETE),
-                Collections.singleton(before.getLeft().getRealm()));
+                before.getLeft().getRealm());
         securityChecks(effectiveRealms, before.getLeft().getRealm(), before.getLeft().getKey());
 
         List<Group> ownedGroups = groupDAO.findOwnedByGroup(before.getLeft().getKey());
@@ -248,7 +244,7 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO, GroupPatch> {
         GroupTO group = binder.getGroupTO(key);
         Set<String> effectiveRealms = getEffectiveRealms(
                 AuthContextUtils.getAuthorizations().get(StandardEntitlement.GROUP_UPDATE),
-                Collections.singleton(group.getRealm()));
+                group.getRealm());
         securityChecks(effectiveRealms, group.getRealm(), group.getKey());
 
         GroupPatch patch = new GroupPatch();
@@ -271,7 +267,7 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO, GroupPatch> {
         GroupTO group = binder.getGroupTO(key);
         Set<String> effectiveRealms = getEffectiveRealms(
                 AuthContextUtils.getAuthorizations().get(StandardEntitlement.GROUP_UPDATE),
-                Collections.singleton(group.getRealm()));
+                group.getRealm());
         securityChecks(effectiveRealms, group.getRealm(), group.getKey());
 
         GroupPatch patch = new GroupPatch();
@@ -296,7 +292,7 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO, GroupPatch> {
         GroupTO group = binder.getGroupTO(key);
         Set<String> effectiveRealms = getEffectiveRealms(
                 AuthContextUtils.getAuthorizations().get(StandardEntitlement.GROUP_UPDATE),
-                Collections.singleton(group.getRealm()));
+                group.getRealm());
         securityChecks(effectiveRealms, group.getRealm(), group.getKey());
 
         GroupPatch patch = new GroupPatch();
@@ -325,7 +321,7 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO, GroupPatch> {
         GroupTO group = binder.getGroupTO(key);
         Set<String> effectiveRealms = getEffectiveRealms(
                 AuthContextUtils.getAuthorizations().get(StandardEntitlement.GROUP_UPDATE),
-                Collections.singleton(group.getRealm()));
+                group.getRealm());
         securityChecks(effectiveRealms, group.getRealm(), group.getKey());
 
         GroupPatch patch = new GroupPatch();
@@ -350,7 +346,7 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO, GroupPatch> {
         GroupTO group = binder.getGroupTO(key);
         Set<String> effectiveRealms = getEffectiveRealms(
                 AuthContextUtils.getAuthorizations().get(StandardEntitlement.GROUP_UPDATE),
-                Collections.singleton(group.getRealm()));
+                group.getRealm());
         securityChecks(effectiveRealms, group.getRealm(), group.getKey());
 
         List<PropagationStatus> statuses = provisioningManager.deprovision(key, resources, nullPriorityAsync);
@@ -374,7 +370,7 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO, GroupPatch> {
         GroupTO group = binder.getGroupTO(key);
         Set<String> effectiveRealms = getEffectiveRealms(
                 AuthContextUtils.getAuthorizations().get(StandardEntitlement.GROUP_UPDATE),
-                Collections.singleton(group.getRealm()));
+                group.getRealm());
         securityChecks(effectiveRealms, group.getRealm(), group.getKey());
 
         List<PropagationStatus> statuses = provisioningManager.provision(key, resources, nullPriorityAsync);

http://git-wip-us.apache.org/repos/asf/syncope/blob/59106ffc/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 e505f3c..63e7984 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
@@ -22,7 +22,6 @@ import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import org.apache.commons.collections4.CollectionUtils;
@@ -102,9 +101,9 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch> {
     @PreAuthorize("hasRole('" + StandardEntitlement.USER_LIST + "')")
     @Transactional(readOnly = true)
     @Override
-    public int count(final List<String> realms) {
+    public int count(final String realm) {
         return userDAO.count(
-                getEffectiveRealms(AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_LIST), realms));
+                getEffectiveRealms(AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_LIST), realm));
     }
 
     @PreAuthorize("hasRole('" + StandardEntitlement.USER_LIST + "')")
@@ -112,10 +111,10 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch> {
     @Override
     public List<UserTO> list(
             final int page, final int size, final List<OrderByClause> orderBy,
-            final List<String> realms, final boolean details) {
+            final String realm, final boolean details) {
 
         return CollectionUtils.collect(userDAO.findAll(
-                getEffectiveRealms(AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_LIST), realms),
+                getEffectiveRealms(AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_LIST), realm),
                 page, size, orderBy),
                 new Transformer<User, UserTO>() {
 
@@ -144,9 +143,9 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch> {
     @PreAuthorize("hasRole('" + StandardEntitlement.USER_SEARCH + "')")
     @Transactional(readOnly = true)
     @Override
-    public int searchCount(final SearchCond searchCondition, final List<String> realms) {
+    public int searchCount(final SearchCond searchCondition, final String realm) {
         return searchDAO.count(
-                getEffectiveRealms(AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_SEARCH), realms),
+                getEffectiveRealms(AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_SEARCH), realm),
                 searchCondition, AnyTypeKind.USER);
     }
 
@@ -154,10 +153,10 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch> {
     @Transactional(readOnly = true)
     @Override
     public List<UserTO> search(final SearchCond searchCondition, final int page, final int size,
-            final List<OrderByClause> orderBy, final List<String> realms, final boolean details) {
+            final List<OrderByClause> orderBy, final String realm, final boolean details) {
 
         List<User> matchingUsers = searchDAO.search(
-                getEffectiveRealms(AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_SEARCH), realms),
+                getEffectiveRealms(AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_SEARCH), realm),
                 searchCondition, page, size, orderBy, AnyTypeKind.USER);
         return CollectionUtils.collect(matchingUsers, new Transformer<User, UserTO>() {
 
@@ -203,7 +202,7 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch> {
         if (!self) {
             Set<String> effectiveRealms = getEffectiveRealms(
                     AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_CREATE),
-                    Collections.singleton(before.getLeft().getRealm()));
+                    before.getLeft().getRealm());
             securityChecks(effectiveRealms, before.getLeft().getRealm(), null);
         }
 
@@ -236,11 +235,9 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch> {
                 && before.getLeft().getRealm() != null
                 && StringUtils.isNotBlank(before.getLeft().getRealm().getValue())) {
 
-            Set<String> requestedRealms = new HashSet<>();
-            requestedRealms.add(before.getLeft().getRealm().getValue());
             Set<String> effectiveRealms = getEffectiveRealms(
                     AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_UPDATE),
-                    requestedRealms);
+                    before.getLeft().getRealm().getValue());
             securityChecks(effectiveRealms, before.getLeft().getRealm().getValue(), before.getLeft().getKey());
         }
 
@@ -279,7 +276,7 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch> {
         UserTO toUpdate = binder.getUserTO(statusPatch.getKey());
         Set<String> effectiveRealms = getEffectiveRealms(
                 AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_UPDATE),
-                Collections.singleton(toUpdate.getRealm()));
+                toUpdate.getRealm());
         securityChecks(effectiveRealms, toUpdate.getRealm(), toUpdate.getKey());
 
         Pair<Long, List<PropagationStatus>> updated = setStatusOnWfAdapter(statusPatch, nullPriorityAsync);
@@ -350,7 +347,7 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch> {
         if (!self) {
             Set<String> effectiveRealms = getEffectiveRealms(
                     AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_DELETE),
-                    Collections.singleton(before.getLeft().getRealm()));
+                    before.getLeft().getRealm());
             securityChecks(effectiveRealms, before.getLeft().getRealm(), before.getLeft().getKey());
         }
 
@@ -387,7 +384,7 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch> {
         UserTO user = binder.getUserTO(key);
         Set<String> effectiveRealms = getEffectiveRealms(
                 AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_UPDATE),
-                Collections.singleton(user.getRealm()));
+                user.getRealm());
         securityChecks(effectiveRealms, user.getRealm(), user.getKey());
 
         UserPatch patch = new UserPatch();
@@ -410,7 +407,7 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch> {
         UserTO user = binder.getUserTO(key);
         Set<String> effectiveRealms = getEffectiveRealms(
                 AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_UPDATE),
-                Collections.singleton(user.getRealm()));
+                user.getRealm());
         securityChecks(effectiveRealms, user.getRealm(), user.getKey());
 
         UserPatch patch = new UserPatch();
@@ -435,7 +432,7 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch> {
         UserTO user = binder.getUserTO(key);
         Set<String> effectiveRealms = getEffectiveRealms(
                 AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_UPDATE),
-                Collections.singleton(user.getRealm()));
+                user.getRealm());
         securityChecks(effectiveRealms, user.getRealm(), user.getKey());
 
         UserPatch patch = new UserPatch();
@@ -464,7 +461,7 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch> {
         UserTO user = binder.getUserTO(key);
         Set<String> effectiveRealms = getEffectiveRealms(
                 AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_UPDATE),
-                Collections.singleton(user.getRealm()));
+                user.getRealm());
         securityChecks(effectiveRealms, user.getRealm(), user.getKey());
 
         UserPatch patch = new UserPatch();
@@ -494,7 +491,7 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch> {
         UserTO user = binder.getUserTO(key);
         Set<String> effectiveRealms = getEffectiveRealms(
                 AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_UPDATE),
-                Collections.singleton(user.getRealm()));
+                user.getRealm());
         securityChecks(effectiveRealms, user.getRealm(), user.getKey());
 
         List<PropagationStatus> statuses = provisioningManager.deprovision(key, resources, nullPriorityAsync);
@@ -518,7 +515,7 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch> {
         UserTO user = binder.getUserTO(key);
         Set<String> effectiveRealms = getEffectiveRealms(
                 AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_UPDATE),
-                Collections.singleton(user.getRealm()));
+                user.getRealm());
         securityChecks(effectiveRealms, user.getRealm(), user.getKey());
 
         List<PropagationStatus> statuses =

http://git-wip-us.apache.org/repos/asf/syncope/blob/59106ffc/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondConverter.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondConverter.java b/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondConverter.java
index db3a80f..77b959b 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondConverter.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondConverter.java
@@ -35,15 +35,19 @@ public final class SearchCondConverter {
      * Parses a FIQL expression into Syncope's <tt>SearchCond</tt>, using CXF's <tt>FiqlParser</tt>.
      *
      * @param fiqlExpression FIQL string
+     * @param realms optional realm to provide to {@link SearchCondVisitor}
      * @return {@link SearchCond} instance for given FIQL expression
      * @see FiqlParser
      */
-    public static SearchCond convert(final String fiqlExpression) {
+    public static SearchCond convert(final String fiqlExpression, final String... realms) {
         FiqlParser<SearchBean> fiqlParser = new FiqlParser<>(
                 SearchBean.class, AbstractFiqlSearchConditionBuilder.CONTEXTUAL_PROPERTIES);
 
         try {
             SearchCondVisitor searchCondVisitor = new SearchCondVisitor();
+            if (realms != null && realms.length > 0) {
+                searchCondVisitor.setRealm(realms[0]);
+            }
             searchCondVisitor.visit(fiqlParser.parse(fiqlExpression));
             return searchCondVisitor.getQuery();
         } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/59106ffc/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondVisitor.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondVisitor.java b/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondVisitor.java
index 1fe03d2..402005b 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondVisitor.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondVisitor.java
@@ -20,7 +20,6 @@ package org.apache.syncope.core.misc.search;
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Map;
 import org.apache.cxf.jaxrs.ext.search.ConditionType;
 import org.apache.cxf.jaxrs.ext.search.SearchBean;
 import org.apache.cxf.jaxrs.ext.search.SearchCondition;
@@ -56,14 +55,16 @@ public class SearchCondVisitor extends AbstractSearchConditionVisitor<SearchBean
         ANY_FIELDS.addAll(SearchableFields.get(AnyObjectTO.class));
     }
 
+    private String realm;
+
     private SearchCond searchCond;
 
     public SearchCondVisitor() {
         super(null);
     }
 
-    public SearchCondVisitor(final Map<String, String> fieldMap) {
-        super(fieldMap);
+    public void setRealm(final String realm) {
+        this.realm = realm;
     }
 
     private AttributeCond createAttributeCond(final String schema) {
@@ -140,7 +141,7 @@ public class SearchCondVisitor extends AbstractSearchConditionVisitor<SearchBean
 
                         case ASSIGNABLE:
                             AssignableCond assignableCond = new AssignableCond();
-                            assignableCond.setRealmFullPath(value);
+                            assignableCond.setRealmFullPath(realm);
                             leaf = SearchCond.getLeafCond(assignableCond);
                             break;
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/59106ffc/core/misc/src/test/java/org/apache/syncope/core/misc/search/SearchCondConverterTest.java
----------------------------------------------------------------------
diff --git a/core/misc/src/test/java/org/apache/syncope/core/misc/search/SearchCondConverterTest.java b/core/misc/src/test/java/org/apache/syncope/core/misc/search/SearchCondConverterTest.java
index e081ffa..189b575 100644
--- a/core/misc/src/test/java/org/apache/syncope/core/misc/search/SearchCondConverterTest.java
+++ b/core/misc/src/test/java/org/apache/syncope/core/misc/search/SearchCondConverterTest.java
@@ -155,14 +155,14 @@ public class SearchCondConverterTest {
 
     @Test
     public void assignable() {
-        String fiqlExpression = new GroupFiqlSearchConditionBuilder().isAssignable("/even/two").query();
-        assertEquals(SpecialAttr.ASSIGNABLE + "==/even/two", fiqlExpression);
+        String fiqlExpression = new GroupFiqlSearchConditionBuilder().isAssignable().query();
+        assertEquals(SpecialAttr.ASSIGNABLE + "==" + SpecialAttr.NULL, fiqlExpression);
 
         AssignableCond assignableCond = new AssignableCond();
         assignableCond.setRealmFullPath("/even/two");
         SearchCond simpleCond = SearchCond.getLeafCond(assignableCond);
 
-        assertEquals(simpleCond, SearchCondConverter.convert(fiqlExpression));
+        assertEquals(simpleCond, SearchCondConverter.convert(fiqlExpression, "/even/two"));
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/syncope/blob/59106ffc/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractAnyService.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractAnyService.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractAnyService.java
index e08c476..609f1f8 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractAnyService.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractAnyService.java
@@ -20,8 +20,6 @@ package org.apache.syncope.core.rest.cxf.service;
 
 import java.util.Set;
 import javax.ws.rs.core.Response;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.Transformer;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.common.lib.AnyOperations;
 import org.apache.syncope.common.lib.SyncopeConstants;
@@ -30,6 +28,7 @@ import org.apache.syncope.common.lib.patch.AssociationPatch;
 import org.apache.syncope.common.lib.patch.AttrPatch;
 import org.apache.syncope.common.lib.patch.DeassociationPatch;
 import org.apache.syncope.common.lib.patch.StatusPatch;
+import org.apache.syncope.common.lib.search.SpecialAttr;
 import org.apache.syncope.common.lib.to.AnyTO;
 import org.apache.syncope.common.lib.to.AttrTO;
 import org.apache.syncope.common.lib.to.BulkAction;
@@ -110,48 +109,39 @@ public abstract class AbstractAnyService<TO extends AnyTO, P extends AnyPatch>
     }
 
     protected PagedResult<TO> list(final AnyListQuery listQuery) {
-        CollectionUtils.transform(listQuery.getRealms(), new Transformer<String, String>() {
-
-            @Override
-            public String transform(final String input) {
-                return StringUtils.prependIfMissing(input, SyncopeConstants.ROOT_REALM);
-            }
-        });
+        String realm = StringUtils.prependIfMissing(listQuery.getRealm(), SyncopeConstants.ROOT_REALM);
 
         return buildPagedResult(
                 getAnyLogic().list(
                         listQuery.getPage(),
                         listQuery.getSize(),
                         getOrderByClauses(listQuery.getOrderBy()),
-                        listQuery.getRealms(),
+                        realm,
                         listQuery.isDetails()),
                 listQuery.getPage(),
                 listQuery.getSize(),
-                getAnyLogic().count(listQuery.getRealms()));
+                getAnyLogic().count(realm));
     }
 
     @Override
     public PagedResult<TO> search(final AnySearchQuery searchQuery) {
-        CollectionUtils.transform(searchQuery.getRealms(), new Transformer<String, String>() {
+        String realm = StringUtils.prependIfMissing(searchQuery.getRealm(), SyncopeConstants.ROOT_REALM);
 
-            @Override
-            public String transform(final String input) {
-                return StringUtils.prependIfMissing(input, SyncopeConstants.ROOT_REALM);
-            }
-        });
+        // if an assignable query is provided in the FIQL string, start anyway from root realm
+        boolean isAssignableCond = -1 != searchQuery.getFiql().indexOf(SpecialAttr.ASSIGNABLE.toString());
 
-        SearchCond cond = getSearchCond(searchQuery.getFiql());
+        SearchCond cond = getSearchCond(searchQuery.getFiql(), realm);
         return buildPagedResult(
                 getAnyLogic().search(
                         cond,
                         searchQuery.getPage(),
                         searchQuery.getSize(),
                         getOrderByClauses(searchQuery.getOrderBy()),
-                        searchQuery.getRealms(),
+                        isAssignableCond ? SyncopeConstants.ROOT_REALM : realm,
                         searchQuery.isDetails()),
                 searchQuery.getPage(),
                 searchQuery.getSize(),
-                getAnyLogic().searchCount(cond, searchQuery.getRealms()));
+                getAnyLogic().searchCount(cond, isAssignableCond ? SyncopeConstants.ROOT_REALM : realm));
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/59106ffc/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractServiceImpl.java
index 85f035f..eec8927 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractServiceImpl.java
@@ -142,9 +142,10 @@ abstract class AbstractServiceImpl implements JAXRSService {
         }
     }
 
-    protected SearchCond getSearchCond(final String fiql) {
+    protected SearchCond getSearchCond(final String fiql, final String realm) {
         try {
             SearchCondVisitor visitor = new SearchCondVisitor();
+            visitor.setRealm(realm);
             SearchCondition<SearchBean> sc = searchContext.getCondition(fiql, SearchBean.class);
             sc.accept(visitor);
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/59106ffc/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AnyObjectServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AnyObjectServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AnyObjectServiceImpl.java
index 82d8647..10c46a8 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AnyObjectServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AnyObjectServiceImpl.java
@@ -67,7 +67,7 @@ public class AnyObjectServiceImpl extends AbstractAnyService<AnyObjectTO, AnyObj
         searchQuery.setOrderBy(listQuery.getOrderBy());
         searchQuery.setPage(listQuery.getPage());
         searchQuery.setSize(listQuery.getSize());
-        searchQuery.setRealms(listQuery.getRealms());
+        searchQuery.setRealm(listQuery.getRealm());
 
         return search(searchQuery);
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/59106ffc/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SearchITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SearchITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SearchITCase.java
index d7b8796..7b07728 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SearchITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SearchITCase.java
@@ -345,9 +345,9 @@ public class SearchITCase extends AbstractITCase {
     @Test
     public void assignable() {
         PagedResult<GroupTO> groups = groupService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
-                fiql(SyncopeClient.getGroupSearchConditionBuilder().
-                        isAssignable("/even/two").query()).
+                new AnySearchQuery.Builder().realm("/even/two").
+                fiql(SyncopeClient.getGroupSearchConditionBuilder().isAssignable().
+                        and("name").equalTo("*").query()).
                 build());
         assertNotNull(groups);
         assertTrue(CollectionUtils.exists(groups.getResult(), new Predicate<GroupTO>() {
@@ -366,9 +366,9 @@ public class SearchITCase extends AbstractITCase {
         }));
 
         PagedResult<AnyObjectTO> anyObjects = anyObjectService.search(
-                new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
-                fiql(SyncopeClient.getAnyObjectSearchConditionBuilder("PRINTER").
-                        isAssignable("/odd").query()).
+                new AnySearchQuery.Builder().realm("/odd").
+                fiql(SyncopeClient.getAnyObjectSearchConditionBuilder("PRINTER").isAssignable().
+                        and("name").equalTo("*").query()).
                 build());
         assertNotNull(anyObjects);
         assertFalse(CollectionUtils.exists(anyObjects.getResult(), new Predicate<AnyObjectTO>() {