Re: Syncope ignores braces "( )"

2016-09-02 Thread Francesco Chicchiriccò
- Il 2-set-16, alle 15:58, Colm O hEigeartaigh  ha 
scritto: 

> Hehe ok will revisit next week!

Cool! 

> On Fri, Sep 2, 2016 at 2:51 PM, Francesco Chicchiriccò < ilgro...@apache.org >
> wrote:

>> - Il 2-set-16, alle 15:29, Colm O hEigeartaigh < cohei...@apache.org > ha
>> scritto:

>>> I updated the patch to also handle "AND". Yes it solves the issue.

>> Now only a unit test in AnySearchTest and a correspondent integration test in
>> SearchITCase are missing, then... ;-)

>>> On Fri, Sep 2, 2016 at 1:38 PM, Francesco Chicchiriccò < 
>>> ilgro...@apache.org >
>>> wrote:

 - Il 2-set-16, alle 14:34, Colm O hEigeartaigh < cohei...@apache.org > 
 ha
 scritto:

> Yep. I've attached a proposed patch to SYNCOPE-929. It simply makes sure 
> that OR
> expressions are encapsulated in parentheses. It feels like a bit of a hack
> though :-)

 I've taken a look at your patch (guess that AND deserves the same 
 treatment...):
 have you already checked if it actually solves this issue?

> On Fri, Sep 2, 2016 at 12:59 PM, Francesco Chicchiriccò < 
> ilgro...@apache.org >
> wrote:

>> - Il 2-set-16, alle 13:33, Colm O hEigeartaigh < cohei...@apache.org 
>> > ha
>> scritto:

>>> Hi Francesco,

>>> I've dug into this a bit deeper. The logic in SearchCondVisitor is fine 
>>> I think.
>>> The problem is in JPAAnySearchDao when the SearchCond is converted into 
>>> a
>>> String. Using the example I gave, 
>>> "(city==dublin,state==abc);country==ireland",
>>> yields the following String:

>>> SELECT DISTINCT any_id FROM user_search_attr WHERE schema_id='city' AND
>>> stringvalue=?1
>>> OR any_id IN ( SELECT DISTINCT any_id FROM user_search_attr WHERE
>>> schema_id='state' AND stringvalue=?2)
>>> AND any_id IN ( SELECT DISTINCT any_id FROM user_search_attr WHERE
>>> schema_id='country' AND stringvalue=?3)

>>> So we have WHERE X OR Y AND Z, instead of WHERE (X OR Y) AND Z, and so 
>>> it
>>> incorrectly evaluates Y AND Z first. The code in JPAAnySearchDao is 
>>> quite
>>> complex, I'll keep digging to see if I can fix it, unless you have an 
>>> easy fix?

>> I believe the key point is around

>> https://github.com/apache/syncope/blob/master/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java#L475-L487

>> Regards.

>>> On Thu, Sep 1, 2016 at 5:20 PM, Francesco Chicchiriccò < 
>>> ilgro...@apache.org >
>>> wrote:

 Hi,
 I have just tried the same sample as above and obtained the same 
 results.

 The FIQL query is parsed into a SearchCond instance [1] by 
 SearchCondVisitor
 [2]: at a first glance, I don't see any reason why parentheses should 
 be
 ignored, but maybe it's only because I am quite tired at the moment :-)

 If you're opening an issue, please set "affects-version" to 2.0.0.M5 
 and
 "fix-for-version" to 2.0.0, thanks.

 Regards.

 [1]
 https://github.com/apache/syncope/blob/master/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/SearchCond.java
 [2]
 https://github.com/apache/syncope/blob/master/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/SearchCondVisitor.java

 On 01/09/2016 18:18, Colm O hEigeartaigh wrote:

> Hi Iurii,

> Yep there is an issue here. Could you open a JIRA for it?

> I can reproduce with two users with attributes (city/country/state):

> alice: dublin/ireland/abc
> bob: dublin/canada/xyz

> Using a FIQL of "city==dublin;country==ireland" using 
> AnyQuery.Builder()
> correctly yields one user ("alice"). However using
> "(city==dublin,state==abc);country==ireland" yields both users 
> incorrectly. It
> appears that it might be ignoring the country part and just returning 
> the
> result of the brackets.

> Colm.

> On Thu, Sep 1, 2016 at 4:21 PM, Iurii Smyrnov < ismyr...@talend.com > 
> wrote:

>> Hi Syncope Devs,
>> Could you please check Does Syncope support braces " ( ) " in a FIQL 
>> request ?

>> I faced with an issue: it seems Syncope ignores braces in the 
>> request, for
>> example (get groups items):
>> - request is : (name==testA,name==testB);name==testC
>> - the same request ( http encoded ) is:
>> http://192.168.99.100:9080/syncope/rest/groups?fiql=
>> %28name%3D%3DtestA%2Cname%3D%3DtestB%29%3Bname%3D%3DtestC

>> In this case response should return zero items , but it returns 
>> Group item with
>> name=testA - the same result if there would not been braces like 
>> below:
>> - request is : name==testA

Re: Syncope ignores braces "( )"

2016-09-02 Thread Colm O hEigeartaigh
Hehe ok will revisit next week!

Colm.

On Fri, Sep 2, 2016 at 2:51 PM, Francesco Chicchiriccò 
wrote:

> - Il 2-set-16, alle 15:29, Colm O hEigeartaigh 
> ha scritto:
>
> I updated the patch to also handle "AND". Yes it solves the issue.
>
>
> Now only a unit test in AnySearchTest and a correspondent integration test
> in SearchITCase are missing, then... ;-)
>
> On Fri, Sep 2, 2016 at 1:38 PM, Francesco Chicchiriccò <
> ilgro...@apache.org> wrote:
>
>> - Il 2-set-16, alle 14:34, Colm O hEigeartaigh 
>> ha scritto:
>>
>> Yep. I've attached a proposed patch to SYNCOPE-929. It simply makes sure
>> that OR expressions are encapsulated in parentheses. It feels like a bit of
>> a hack though :-)
>>
>> I've taken a look at your patch (guess that AND deserves the same
>> treatment...): have you already checked if it actually solves this issue?
>>
>> On Fri, Sep 2, 2016 at 12:59 PM, Francesco Chicchiriccò <
>> ilgro...@apache.org> wrote:
>>
>>> - Il 2-set-16, alle 13:33, Colm O hEigeartaigh 
>>> ha scritto:
>>>
>>> Hi Francesco,
>>>
>>> I've dug into this a bit deeper. The logic in SearchCondVisitor is fine
>>> I think. The problem is in JPAAnySearchDao when the SearchCond is converted
>>> into a String. Using the example I gave, 
>>> "(city==dublin,state==abc);country==ireland",
>>> yields the following String:
>>>
>>> SELECT DISTINCT any_id FROM user_search_attr WHERE schema_id='city' AND
>>> stringvalue=?1
>>> OR any_id IN ( SELECT DISTINCT any_id FROM user_search_attr WHERE
>>> schema_id='state' AND stringvalue=?2)
>>> AND any_id IN ( SELECT DISTINCT any_id FROM user_search_attr WHERE
>>> schema_id='country' AND stringvalue=?3)
>>>
>>> So we have WHERE X OR Y AND Z, instead of WHERE (X OR Y) AND Z, and so
>>> it incorrectly evaluates Y AND Z first. The code in JPAAnySearchDao is
>>> quite complex, I'll keep digging to see if I can fix it, unless you have an
>>> easy fix?
>>>
>>> I believe the key point is around
>>>
>>> https://github.com/apache/syncope/blob/master/core/
>>> persistence-jpa/src/main/java/org/apache/syncope/core/
>>> persistence/jpa/dao/JPAAnySearchDAO.java#L475-L487
>>>
>>> Regards.
>>>
>>>
>>> On Thu, Sep 1, 2016 at 5:20 PM, Francesco Chicchiriccò <
>>> ilgro...@apache.org> wrote:
>>>
 Hi,
 I have just tried the same sample as above and obtained the same
 results.

 The FIQL query is parsed into a SearchCond instance [1] by
 SearchCondVisitor [2]: at a first glance, I don't see any reason why
 parentheses should be ignored, but maybe it's only because I am quite tired
 at the moment :-)

 If you're opening an issue, please set "affects-version" to 2.0.0.M5
 and "fix-for-version" to 2.0.0, thanks.

 Regards.

 [1] https://github.com/apache/syncope/blob/master/core/
 persistence-api/src/main/java/org/apache/syncope/core/
 persistence/api/dao/search/SearchCond.java
 [2] https://github.com/apache/syncope/blob/master/core/
 persistence-api/src/main/java/org/apache/syncope/core/
 persistence/api/search/SearchCondVisitor.java

 On 01/09/2016 18:18, Colm O hEigeartaigh wrote:

 Hi Iurii,

 Yep there is an issue here. Could you open a JIRA for it?

 I can reproduce with two users with attributes (city/country/state):

 alice: dublin/ireland/abc
 bob: dublin/canada/xyz

 Using a FIQL of "city==dublin;country==ireland" using
 AnyQuery.Builder() correctly yields one user ("alice"). However using
 "(city==dublin,state==abc);country==ireland" yields both users
 incorrectly. It appears that it might be ignoring the country part and just
 returning the result of the brackets.

 Colm.

 On Thu, Sep 1, 2016 at 4:21 PM, Iurii Smyrnov 
 wrote:

>
> Hi Syncope Devs,
>   Could you please check Does Syncope support braces " ( ) " in a
> FIQL request ?
>
> I faced with an issue: it seems Syncope ignores braces in the request,
> for example (get groups items):
> - request is : (name==testA,name==testB);name==testC
> - the same request (http encoded) is: http://192.
> 168.99.100:9080/syncope/rest/groups?fiql=
> 
> %28name%3D%3DtestA%2Cname%3D%3DtestB%29%3Bname%3D%3DtestC
> 
>
> In this case response should return zero items , but it returns Group
> item with name=testA  - the same result if there would not been braces 
> like
> below:
> - request is : name==testA,name==testB;name==testC or FIQL encode
> name%3D%3DtestA%2Cname%3D%3DtestB%3Bname%3D%3DtestC
> 
>
>
> It seems Syncope ignores braces "( )".
>
> --
 Frances

Re: Syncope ignores braces "( )"

2016-09-02 Thread Francesco Chicchiriccò
- Il 2-set-16, alle 15:29, Colm O hEigeartaigh  ha 
scritto: 

> I updated the patch to also handle "AND". Yes it solves the issue.

Now only a unit test in AnySearchTest and a correspondent integration test in 
SearchITCase are missing, then... ;-) 

> On Fri, Sep 2, 2016 at 1:38 PM, Francesco Chicchiriccò < ilgro...@apache.org >
> wrote:

>> - Il 2-set-16, alle 14:34, Colm O hEigeartaigh < cohei...@apache.org > ha
>> scritto:

>>> Yep. I've attached a proposed patch to SYNCOPE-929. It simply makes sure 
>>> that OR
>>> expressions are encapsulated in parentheses. It feels like a bit of a hack
>>> though :-)

>> I've taken a look at your patch (guess that AND deserves the same 
>> treatment...):
>> have you already checked if it actually solves this issue?

>>> On Fri, Sep 2, 2016 at 12:59 PM, Francesco Chicchiriccò < 
>>> ilgro...@apache.org >
>>> wrote:

 - Il 2-set-16, alle 13:33, Colm O hEigeartaigh < cohei...@apache.org > 
 ha
 scritto:

> Hi Francesco,

> I've dug into this a bit deeper. The logic in SearchCondVisitor is fine I 
> think.
> The problem is in JPAAnySearchDao when the SearchCond is converted into a
> String. Using the example I gave, 
> "(city==dublin,state==abc);country==ireland",
> yields the following String:

> SELECT DISTINCT any_id FROM user_search_attr WHERE schema_id='city' AND
> stringvalue=?1
> OR any_id IN ( SELECT DISTINCT any_id FROM user_search_attr WHERE
> schema_id='state' AND stringvalue=?2)
> AND any_id IN ( SELECT DISTINCT any_id FROM user_search_attr WHERE
> schema_id='country' AND stringvalue=?3)

> So we have WHERE X OR Y AND Z, instead of WHERE (X OR Y) AND Z, and so it
> incorrectly evaluates Y AND Z first. The code in JPAAnySearchDao is quite
> complex, I'll keep digging to see if I can fix it, unless you have an 
> easy fix?

 I believe the key point is around

 https://github.com/apache/syncope/blob/master/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java#L475-L487

 Regards.

> On Thu, Sep 1, 2016 at 5:20 PM, Francesco Chicchiriccò < 
> ilgro...@apache.org >
> wrote:

>> Hi,
>> I have just tried the same sample as above and obtained the same results.

>> The FIQL query is parsed into a SearchCond instance [1] by 
>> SearchCondVisitor
>> [2]: at a first glance, I don't see any reason why parentheses should be
>> ignored, but maybe it's only because I am quite tired at the moment :-)

>> If you're opening an issue, please set "affects-version" to 2.0.0.M5 and
>> "fix-for-version" to 2.0.0, thanks.

>> Regards.

>> [1]
>> https://github.com/apache/syncope/blob/master/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/SearchCond.java
>> [2]
>> https://github.com/apache/syncope/blob/master/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/SearchCondVisitor.java

>> On 01/09/2016 18:18, Colm O hEigeartaigh wrote:

>>> Hi Iurii,

>>> Yep there is an issue here. Could you open a JIRA for it?

>>> I can reproduce with two users with attributes (city/country/state):

>>> alice: dublin/ireland/abc
>>> bob: dublin/canada/xyz

>>> Using a FIQL of "city==dublin;country==ireland" using AnyQuery.Builder()
>>> correctly yields one user ("alice"). However using
>>> "(city==dublin,state==abc);country==ireland" yields both users 
>>> incorrectly. It
>>> appears that it might be ignoring the country part and just returning 
>>> the
>>> result of the brackets.

>>> Colm.

>>> On Thu, Sep 1, 2016 at 4:21 PM, Iurii Smyrnov < ismyr...@talend.com > 
>>> wrote:

 Hi Syncope Devs,
 Could you please check Does Syncope support braces " ( ) " in a FIQL 
 request ?

 I faced with an issue: it seems Syncope ignores braces in the request, 
 for
 example (get groups items):
 - request is : (name==testA,name==testB);name==testC
 - the same request ( http encoded ) is:
 http://192.168.99.100:9080/syncope/rest/groups?fiql=
 %28name%3D%3DtestA%2Cname%3D%3DtestB%29%3Bname%3D%3DtestC

 In this case response should return zero items , but it returns Group 
 item with
 name=testA - the same result if there would not been braces like below:
 - request is : name==testA,name==testB;name==testC or FIQL encode
 name%3D%3DtestA%2Cname%3D%3DtestB%3Bname%3D%3DtestC

 It seems Syncope ignores braces "( )".

>> --
>> Francesco Chicchiriccò

>> Tirasa - Open Source Excellence http://www.tirasa.net/ Involved at The 
>> Apache
>> Software Foundation:
>> member, Syncope PMC chair, Cocoon PMC, Olingo PMC,
>> CXF Committer, OpenJPA Committer, PonyMail PPMC
>> http://home.apache.org/~ilgrosso/

> --
> Colm O h

Re: Syncope ignores braces "( )"

2016-09-02 Thread Colm O hEigeartaigh
I updated the patch to also handle "AND". Yes it solves the issue.

Colm.

On Fri, Sep 2, 2016 at 1:38 PM, Francesco Chicchiriccò 
wrote:

> - Il 2-set-16, alle 14:34, Colm O hEigeartaigh 
> ha scritto:
>
> Yep. I've attached a proposed patch to SYNCOPE-929. It simply makes sure
> that OR expressions are encapsulated in parentheses. It feels like a bit of
> a hack though :-)
>
>
> I've taken a look at your patch (guess that AND deserves the same
> treatment...): have you already checked if it actually solves this issue?
>
> On Fri, Sep 2, 2016 at 12:59 PM, Francesco Chicchiriccò <
> ilgro...@apache.org> wrote:
>
>> - Il 2-set-16, alle 13:33, Colm O hEigeartaigh 
>> ha scritto:
>>
>> Hi Francesco,
>>
>> I've dug into this a bit deeper. The logic in SearchCondVisitor is fine I
>> think. The problem is in JPAAnySearchDao when the SearchCond is converted
>> into a String. Using the example I gave, 
>> "(city==dublin,state==abc);country==ireland",
>> yields the following String:
>>
>> SELECT DISTINCT any_id FROM user_search_attr WHERE schema_id='city' AND
>> stringvalue=?1
>> OR any_id IN ( SELECT DISTINCT any_id FROM user_search_attr WHERE
>> schema_id='state' AND stringvalue=?2)
>> AND any_id IN ( SELECT DISTINCT any_id FROM user_search_attr WHERE
>> schema_id='country' AND stringvalue=?3)
>>
>> So we have WHERE X OR Y AND Z, instead of WHERE (X OR Y) AND Z, and so it
>> incorrectly evaluates Y AND Z first. The code in JPAAnySearchDao is quite
>> complex, I'll keep digging to see if I can fix it, unless you have an easy
>> fix?
>>
>> I believe the key point is around
>>
>> https://github.com/apache/syncope/blob/master/core/
>> persistence-jpa/src/main/java/org/apache/syncope/core/
>> persistence/jpa/dao/JPAAnySearchDAO.java#L475-L487
>>
>> Regards.
>>
>>
>> On Thu, Sep 1, 2016 at 5:20 PM, Francesco Chicchiriccò <
>> ilgro...@apache.org> wrote:
>>
>>> Hi,
>>> I have just tried the same sample as above and obtained the same results.
>>>
>>> The FIQL query is parsed into a SearchCond instance [1] by
>>> SearchCondVisitor [2]: at a first glance, I don't see any reason why
>>> parentheses should be ignored, but maybe it's only because I am quite tired
>>> at the moment :-)
>>>
>>> If you're opening an issue, please set "affects-version" to 2.0.0.M5 and
>>> "fix-for-version" to 2.0.0, thanks.
>>>
>>> Regards.
>>>
>>> [1] https://github.com/apache/syncope/blob/master/core/
>>> persistence-api/src/main/java/org/apache/syncope/core/
>>> persistence/api/dao/search/SearchCond.java
>>> [2] https://github.com/apache/syncope/blob/master/core/
>>> persistence-api/src/main/java/org/apache/syncope/core/
>>> persistence/api/search/SearchCondVisitor.java
>>>
>>> On 01/09/2016 18:18, Colm O hEigeartaigh wrote:
>>>
>>> Hi Iurii,
>>>
>>> Yep there is an issue here. Could you open a JIRA for it?
>>>
>>> I can reproduce with two users with attributes (city/country/state):
>>>
>>> alice: dublin/ireland/abc
>>> bob: dublin/canada/xyz
>>>
>>> Using a FIQL of "city==dublin;country==ireland" using
>>> AnyQuery.Builder() correctly yields one user ("alice"). However using
>>> "(city==dublin,state==abc);country==ireland" yields both users
>>> incorrectly. It appears that it might be ignoring the country part and just
>>> returning the result of the brackets.
>>>
>>> Colm.
>>>
>>> On Thu, Sep 1, 2016 at 4:21 PM, Iurii Smyrnov 
>>> wrote:
>>>

 Hi Syncope Devs,
   Could you please check Does Syncope support braces " ( ) " in a
 FIQL request ?

 I faced with an issue: it seems Syncope ignores braces in the request,
 for example (get groups items):
 - request is : (name==testA,name==testB);name==testC
 - the same request (http encoded) is: http://192.
 168.99.100:9080/syncope/rest/groups?fiql=
 
 %28name%3D%3DtestA%2Cname%3D%3DtestB%29%3Bname%3D%3DtestC
 

 In this case response should return zero items , but it returns Group
 item with name=testA  - the same result if there would not been braces like
 below:
 - request is : name==testA,name==testB;name==testC or FIQL encode
 name%3D%3DtestA%2Cname%3D%3DtestB%3Bname%3D%3DtestC
 


 It seems Syncope ignores braces "( )".

 --
>>> Francesco Chicchiriccò
>>>
>>> Tirasa - Open Source Excellencehttp://www.tirasa.net/
>>>
>>> Involved at The Apache Software Foundation:
>>> member, Syncope PMC chair, Cocoon PMC, Olingo PMC,
>>> CXF Committer, OpenJPA Committer, PonyMail 
>>> PPMChttp://home.apache.org/~ilgrosso/
>>>
>>>
>>
>>
>> --
>> Colm O hEigeartaigh
>>
>> Talend Community Coder
>> http://coders.talend.com
>>
>>
>>
>> --
>> Francesco Chicchiriccò
>>
>> Tirasa - Open Source Exce

Re: Syncope ignores braces "( )"

2016-09-02 Thread Francesco Chicchiriccò
- Il 2-set-16, alle 14:34, Colm O hEigeartaigh  ha 
scritto: 

> Yep. I've attached a proposed patch to SYNCOPE-929. It simply makes sure that 
> OR
> expressions are encapsulated in parentheses. It feels like a bit of a hack
> though :-)

I've taken a look at your patch (guess that AND deserves the same 
treatment...): have you already checked if it actually solves this issue? 

> On Fri, Sep 2, 2016 at 12:59 PM, Francesco Chicchiriccò < ilgro...@apache.org 
> >
> wrote:

>> - Il 2-set-16, alle 13:33, Colm O hEigeartaigh < cohei...@apache.org > ha
>> scritto:

>>> Hi Francesco,

>>> I've dug into this a bit deeper. The logic in SearchCondVisitor is fine I 
>>> think.
>>> The problem is in JPAAnySearchDao when the SearchCond is converted into a
>>> String. Using the example I gave, 
>>> "(city==dublin,state==abc);country==ireland",
>>> yields the following String:

>>> SELECT DISTINCT any_id FROM user_search_attr WHERE schema_id='city' AND
>>> stringvalue=?1
>>> OR any_id IN ( SELECT DISTINCT any_id FROM user_search_attr WHERE
>>> schema_id='state' AND stringvalue=?2)
>>> AND any_id IN ( SELECT DISTINCT any_id FROM user_search_attr WHERE
>>> schema_id='country' AND stringvalue=?3)

>>> So we have WHERE X OR Y AND Z, instead of WHERE (X OR Y) AND Z, and so it
>>> incorrectly evaluates Y AND Z first. The code in JPAAnySearchDao is quite
>>> complex, I'll keep digging to see if I can fix it, unless you have an easy 
>>> fix?

>> I believe the key point is around

>> https://github.com/apache/syncope/blob/master/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java#L475-L487

>> Regards.

>>> On Thu, Sep 1, 2016 at 5:20 PM, Francesco Chicchiriccò < 
>>> ilgro...@apache.org >
>>> wrote:

 Hi,
 I have just tried the same sample as above and obtained the same results.

 The FIQL query is parsed into a SearchCond instance [1] by 
 SearchCondVisitor
 [2]: at a first glance, I don't see any reason why parentheses should be
 ignored, but maybe it's only because I am quite tired at the moment :-)

 If you're opening an issue, please set "affects-version" to 2.0.0.M5 and
 "fix-for-version" to 2.0.0, thanks.

 Regards.

 [1]
 https://github.com/apache/syncope/blob/master/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/SearchCond.java
 [2]
 https://github.com/apache/syncope/blob/master/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/SearchCondVisitor.java

 On 01/09/2016 18:18, Colm O hEigeartaigh wrote:

> Hi Iurii,

> Yep there is an issue here. Could you open a JIRA for it?

> I can reproduce with two users with attributes (city/country/state):

> alice: dublin/ireland/abc
> bob: dublin/canada/xyz

> Using a FIQL of "city==dublin;country==ireland" using AnyQuery.Builder()
> correctly yields one user ("alice"). However using
> "(city==dublin,state==abc);country==ireland" yields both users 
> incorrectly. It
> appears that it might be ignoring the country part and just returning the
> result of the brackets.

> Colm.

> On Thu, Sep 1, 2016 at 4:21 PM, Iurii Smyrnov < ismyr...@talend.com > 
> wrote:

>> Hi Syncope Devs,
>> Could you please check Does Syncope support braces " ( ) " in a FIQL 
>> request ?

>> I faced with an issue: it seems Syncope ignores braces in the request, 
>> for
>> example (get groups items):
>> - request is : (name==testA,name==testB);name==testC
>> - the same request ( http encoded ) is:
>> http://192.168.99.100:9080/syncope/rest/groups?fiql=
>> %28name%3D%3DtestA%2Cname%3D%3DtestB%29%3Bname%3D%3DtestC

>> In this case response should return zero items , but it returns Group 
>> item with
>> name=testA - the same result if there would not been braces like below:
>> - request is : name==testA,name==testB;name==testC or FIQL encode
>> name%3D%3DtestA%2Cname%3D%3DtestB%3Bname%3D%3DtestC

>> It seems Syncope ignores braces "( )".

 --
 Francesco Chicchiriccò

 Tirasa - Open Source Excellence http://www.tirasa.net/ Involved at The 
 Apache
 Software Foundation:
 member, Syncope PMC chair, Cocoon PMC, Olingo PMC,
 CXF Committer, OpenJPA Committer, PonyMail PPMC
 http://home.apache.org/~ilgrosso/

>>> --
>>> Colm O hEigeartaigh

>>> Talend Community Coder
>>> http://coders.talend.com

>> --
>> Francesco Chicchiriccò

>> Tirasa - Open Source Excellence
>> http://www.tirasa.net/

>> Involved at The Apache Software Foundation:
>> member, Syncope PMC chair, Cocoon PMC, Olingo PMC,
>> CXF Committer, OpenJPA Committer, PonyMail PPMC
>> http://home.apache.org/~ilgrosso/

> --
> Colm O hEigeartaigh

> Talend Community Coder
> http://coders.talend.com

-- 
Francesco Chicchiriccò 

Tirasa - Open Source Excellence 
http://www.tirasa.net/ 

Involved at The Apache Software Foundation: 
m

Re: Syncope ignores braces "( )"

2016-09-02 Thread Colm O hEigeartaigh
Yep. I've attached a proposed patch to SYNCOPE-929. It simply makes sure
that OR expressions are encapsulated in parentheses. It feels like a bit of
a hack though :-)

Colm.

On Fri, Sep 2, 2016 at 12:59 PM, Francesco Chicchiriccò  wrote:

> - Il 2-set-16, alle 13:33, Colm O hEigeartaigh 
> ha scritto:
>
> Hi Francesco,
>
> I've dug into this a bit deeper. The logic in SearchCondVisitor is fine I
> think. The problem is in JPAAnySearchDao when the SearchCond is converted
> into a String. Using the example I gave, 
> "(city==dublin,state==abc);country==ireland",
> yields the following String:
>
> SELECT DISTINCT any_id FROM user_search_attr WHERE schema_id='city' AND
> stringvalue=?1
> OR any_id IN ( SELECT DISTINCT any_id FROM user_search_attr WHERE
> schema_id='state' AND stringvalue=?2)
> AND any_id IN ( SELECT DISTINCT any_id FROM user_search_attr WHERE
> schema_id='country' AND stringvalue=?3)
>
> So we have WHERE X OR Y AND Z, instead of WHERE (X OR Y) AND Z, and so it
> incorrectly evaluates Y AND Z first. The code in JPAAnySearchDao is quite
> complex, I'll keep digging to see if I can fix it, unless you have an easy
> fix?
>
>
> I believe the key point is around
>
> https://github.com/apache/syncope/blob/master/core/
> persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/
> JPAAnySearchDAO.java#L475-L487
>
> Regards.
>
>
> On Thu, Sep 1, 2016 at 5:20 PM, Francesco Chicchiriccò <
> ilgro...@apache.org> wrote:
>
>> Hi,
>> I have just tried the same sample as above and obtained the same results.
>>
>> The FIQL query is parsed into a SearchCond instance [1] by
>> SearchCondVisitor [2]: at a first glance, I don't see any reason why
>> parentheses should be ignored, but maybe it's only because I am quite tired
>> at the moment :-)
>>
>> If you're opening an issue, please set "affects-version" to 2.0.0.M5 and
>> "fix-for-version" to 2.0.0, thanks.
>>
>> Regards.
>>
>> [1] https://github.com/apache/syncope/blob/master/core/
>> persistence-api/src/main/java/org/apache/syncope/core/
>> persistence/api/dao/search/SearchCond.java
>> [2] https://github.com/apache/syncope/blob/master/core/
>> persistence-api/src/main/java/org/apache/syncope/core/
>> persistence/api/search/SearchCondVisitor.java
>>
>> On 01/09/2016 18:18, Colm O hEigeartaigh wrote:
>>
>> Hi Iurii,
>>
>> Yep there is an issue here. Could you open a JIRA for it?
>>
>> I can reproduce with two users with attributes (city/country/state):
>>
>> alice: dublin/ireland/abc
>> bob: dublin/canada/xyz
>>
>> Using a FIQL of "city==dublin;country==ireland" using AnyQuery.Builder()
>> correctly yields one user ("alice"). However using
>> "(city==dublin,state==abc);country==ireland" yields both users
>> incorrectly. It appears that it might be ignoring the country part and just
>> returning the result of the brackets.
>>
>> Colm.
>>
>> On Thu, Sep 1, 2016 at 4:21 PM, Iurii Smyrnov 
>> wrote:
>>
>>>
>>> Hi Syncope Devs,
>>>   Could you please check Does Syncope support braces " ( ) " in a
>>> FIQL request ?
>>>
>>> I faced with an issue: it seems Syncope ignores braces in the request,
>>> for example (get groups items):
>>> - request is : (name==testA,name==testB);name==testC
>>> - the same request (http encoded) is: http://192.
>>> 168.99.100:9080/syncope/rest/groups?fiql=
>>> 
>>> %28name%3D%3DtestA%2Cname%3D%3DtestB%29%3Bname%3D%3DtestC
>>> 
>>>
>>> In this case response should return zero items , but it returns Group
>>> item with name=testA  - the same result if there would not been braces like
>>> below:
>>> - request is : name==testA,name==testB;name==testC or FIQL encode
>>> name%3D%3DtestA%2Cname%3D%3DtestB%3Bname%3D%3DtestC
>>> 
>>>
>>>
>>> It seems Syncope ignores braces "( )".
>>>
>>> --
>> Francesco Chicchiriccò
>>
>> Tirasa - Open Source Excellencehttp://www.tirasa.net/
>>
>> Involved at The Apache Software Foundation:
>> member, Syncope PMC chair, Cocoon PMC, Olingo PMC,
>> CXF Committer, OpenJPA Committer, PonyMail 
>> PPMChttp://home.apache.org/~ilgrosso/
>>
>>
>
>
> --
> Colm O hEigeartaigh
>
> Talend Community Coder
> http://coders.talend.com
>
>
>
> --
> Francesco Chicchiriccò
>
> Tirasa - Open Source Excellence
> http://www.tirasa.net/
>
> Involved at The Apache Software Foundation:
> member, Syncope PMC chair, Cocoon PMC, Olingo PMC,
> CXF Committer, OpenJPA Committer, PonyMail PPMC
> http://home.apache.org/~ilgrosso/
>



-- 
Colm O hEigeartaigh

Talend Community Coder
http://coders.talend.com


Re: Syncope ignores braces "( )"

2016-09-02 Thread Francesco Chicchiriccò
- Il 2-set-16, alle 13:33, Colm O hEigeartaigh  ha 
scritto: 

> Hi Francesco,

> I've dug into this a bit deeper. The logic in SearchCondVisitor is fine I 
> think.
> The problem is in JPAAnySearchDao when the SearchCond is converted into a
> String. Using the example I gave, 
> "(city==dublin,state==abc);country==ireland",
> yields the following String:

> SELECT DISTINCT any_id FROM user_search_attr WHERE schema_id='city' AND
> stringvalue=?1
> OR any_id IN ( SELECT DISTINCT any_id FROM user_search_attr WHERE
> schema_id='state' AND stringvalue=?2)
> AND any_id IN ( SELECT DISTINCT any_id FROM user_search_attr WHERE
> schema_id='country' AND stringvalue=?3)

> So we have WHERE X OR Y AND Z, instead of WHERE (X OR Y) AND Z, and so it
> incorrectly evaluates Y AND Z first. The code in JPAAnySearchDao is quite
> complex, I'll keep digging to see if I can fix it, unless you have an easy 
> fix?

I believe the key point is around 

https://github.com/apache/syncope/blob/master/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java#L475-L487
 

Regards. 

> On Thu, Sep 1, 2016 at 5:20 PM, Francesco Chicchiriccò < ilgro...@apache.org >
> wrote:

>> Hi,
>> I have just tried the same sample as above and obtained the same results.

>> The FIQL query is parsed into a SearchCond instance [1] by SearchCondVisitor
>> [2]: at a first glance, I don't see any reason why parentheses should be
>> ignored, but maybe it's only because I am quite tired at the moment :-)

>> If you're opening an issue, please set "affects-version" to 2.0.0.M5 and
>> "fix-for-version" to 2.0.0, thanks.

>> Regards.

>> [1]
>> https://github.com/apache/syncope/blob/master/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/SearchCond.java
>> [2]
>> https://github.com/apache/syncope/blob/master/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/SearchCondVisitor.java

>> On 01/09/2016 18:18, Colm O hEigeartaigh wrote:

>>> Hi Iurii,

>>> Yep there is an issue here. Could you open a JIRA for it?

>>> I can reproduce with two users with attributes (city/country/state):

>>> alice: dublin/ireland/abc
>>> bob: dublin/canada/xyz

>>> Using a FIQL of "city==dublin;country==ireland" using AnyQuery.Builder()
>>> correctly yields one user ("alice"). However using
>>> "(city==dublin,state==abc);country==ireland" yields both users incorrectly. 
>>> It
>>> appears that it might be ignoring the country part and just returning the
>>> result of the brackets.

>>> Colm.

>>> On Thu, Sep 1, 2016 at 4:21 PM, Iurii Smyrnov < ismyr...@talend.com > wrote:

 Hi Syncope Devs,
 Could you please check Does Syncope support braces " ( ) " in a FIQL 
 request ?

 I faced with an issue: it seems Syncope ignores braces in the request, for
 example (get groups items):
 - request is : (name==testA,name==testB);name==testC
 - the same request ( http encoded ) is:
 http://192.168.99.100:9080/syncope/rest/groups?fiql=
 %28name%3D%3DtestA%2Cname%3D%3DtestB%29%3Bname%3D%3DtestC

 In this case response should return zero items , but it returns Group item 
 with
 name=testA - the same result if there would not been braces like below:
 - request is : name==testA,name==testB;name==testC or FIQL encode
 name%3D%3DtestA%2Cname%3D%3DtestB%3Bname%3D%3DtestC

 It seems Syncope ignores braces "( )".

>> --
>> Francesco Chicchiriccò

>> Tirasa - Open Source Excellence http://www.tirasa.net/ Involved at The Apache
>> Software Foundation:
>> member, Syncope PMC chair, Cocoon PMC, Olingo PMC,
>> CXF Committer, OpenJPA Committer, PonyMail PPMC
>> http://home.apache.org/~ilgrosso/

> --
> Colm O hEigeartaigh

> Talend Community Coder
> http://coders.talend.com

-- 
Francesco Chicchiriccò 

Tirasa - Open Source Excellence 
http://www.tirasa.net/ 

Involved at The Apache Software Foundation: 
member, Syncope PMC chair, Cocoon PMC, Olingo PMC, 
CXF Committer, OpenJPA Committer, PonyMail PPMC 
http://home.apache.org/~ilgrosso/ 


Re: Syncope ignores braces "( )"

2016-09-02 Thread Colm O hEigeartaigh
Hi Francesco,

I've dug into this a bit deeper. The logic in SearchCondVisitor is fine I
think. The problem is in JPAAnySearchDao when the SearchCond is converted
into a String. Using the example I gave,
"(city==dublin,state==abc);country==ireland",
yields the following String:

SELECT DISTINCT any_id FROM user_search_attr WHERE schema_id='city' AND
stringvalue=?1
OR any_id IN ( SELECT DISTINCT any_id FROM user_search_attr WHERE
schema_id='state' AND stringvalue=?2)
AND any_id IN ( SELECT DISTINCT any_id FROM user_search_attr WHERE
schema_id='country' AND stringvalue=?3)

So we have WHERE X OR Y AND Z, instead of WHERE (X OR Y) AND Z, and so it
incorrectly evaluates Y AND Z first. The code in JPAAnySearchDao is quite
complex, I'll keep digging to see if I can fix it, unless you have an easy
fix?

Colm.

On Thu, Sep 1, 2016 at 5:20 PM, Francesco Chicchiriccò 
wrote:

> Hi,
> I have just tried the same sample as above and obtained the same results.
>
> The FIQL query is parsed into a SearchCond instance [1] by
> SearchCondVisitor [2]: at a first glance, I don't see any reason why
> parentheses should be ignored, but maybe it's only because I am quite tired
> at the moment :-)
>
> If you're opening an issue, please set "affects-version" to 2.0.0.M5 and
> "fix-for-version" to 2.0.0, thanks.
>
> Regards.
>
> [1] https://github.com/apache/syncope/blob/master/core/
> persistence-api/src/main/java/org/apache/syncope/core/
> persistence/api/dao/search/SearchCond.java
> [2] https://github.com/apache/syncope/blob/master/core/
> persistence-api/src/main/java/org/apache/syncope/core/
> persistence/api/search/SearchCondVisitor.java
>
> On 01/09/2016 18:18, Colm O hEigeartaigh wrote:
>
> Hi Iurii,
>
> Yep there is an issue here. Could you open a JIRA for it?
>
> I can reproduce with two users with attributes (city/country/state):
>
> alice: dublin/ireland/abc
> bob: dublin/canada/xyz
>
> Using a FIQL of "city==dublin;country==ireland" using AnyQuery.Builder()
> correctly yields one user ("alice"). However using
> "(city==dublin,state==abc);country==ireland" yields both users
> incorrectly. It appears that it might be ignoring the country part and just
> returning the result of the brackets.
>
> Colm.
>
> On Thu, Sep 1, 2016 at 4:21 PM, Iurii Smyrnov  wrote:
>
>> Hi Syncope Devs,
>>   Could you please check Does Syncope support braces " ( ) " in a
>> FIQL request ?
>>
>> I faced with an issue: it seems Syncope ignores braces in the request,
>> for example (get groups items):
>> - request is : (name==testA,name==testB);name==testC
>> - the same request (http encoded) is: http://192.
>> 168.99.100:9080/syncope/rest/groups?fiql=
>> 
>> %28name%3D%3DtestA%2Cname%3D%3DtestB%29%3Bname%3D%3DtestC
>> 
>>
>> In this case response should return zero items , but it returns Group
>> item with name=testA  - the same result if there would not been braces like
>> below:
>>  - request is : name==testA,name==testB;name==testC or FIQL encode
>> name%3D%3DtestA%2Cname%3D%3DtestB%3Bname%3D%3DtestC
>> 
>>
>>
>> It seems Syncope ignores braces "( )".
>>
>> 
>>
> --
> Francesco Chicchiriccò
>
> Tirasa - Open Source Excellencehttp://www.tirasa.net/
>
> Involved at The Apache Software Foundation:
> member, Syncope PMC chair, Cocoon PMC, Olingo PMC,
> CXF Committer, OpenJPA Committer, PonyMail 
> PPMChttp://home.apache.org/~ilgrosso/
>
>


-- 
Colm O hEigeartaigh

Talend Community Coder
http://coders.talend.com


Re: Syncope ignores braces "( )"

2016-09-02 Thread Iurii Smyrnov
Francesco,

 Thank you, I've create an issue: 
https://issues.apache.org/jira/browse/SYNCOPE-929


Thanks,

Iurii Smyrnov


From: Francesco Chicchiricc? 
Sent: Friday, September 2, 2016 12:13:36 PM
To: user@syncope.apache.org
Subject: Re: Syncope ignores braces "( )"

So you are not able to access

https://issues.apache.org/jira/secure/CreateIssue!default.jspa

once authenticated?

- Il 2-set-16, alle 10:56, Iurii Smyrnov  ha scritto:

Hi all,

 actually  I just can create Service Desk Request in the Jira 
https://issues.apache.org/jira/secure/Dashboard.jspa , seems I can't create 
Issues.

Could you please help and create the issue for this case ?


Thanks


[cid:f0c5b3b4-5db7-4bcb-b78a-8fb390ab73cf]


Thanks,

Iurii Smyrnov


From: Francesco Chicchiricc? 
Sent: Thursday, September 1, 2016 7:20:25 PM
To: user@syncope.apache.org
Subject: Re: Syncope ignores braces "( )"

Hi,
I have just tried the same sample as above and obtained the same results.

The FIQL query is parsed into a SearchCond instance [1] by SearchCondVisitor 
[2]: at a first glance, I don't see any reason why parentheses should be 
ignored, but maybe it's only because I am quite tired at the moment :-)

If you're opening an issue, please set "affects-version" to 2.0.0.M5 and 
"fix-for-version" to 2.0.0, thanks.

Regards.

[1] 
https://github.com/apache/syncope/blob/master/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/SearchCond.java
[2] 
https://github.com/apache/syncope/blob/master/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/SearchCondVisitor.java

On 01/09/2016 18:18, Colm O hEigeartaigh wrote:
Hi Iurii,

Yep there is an issue here. Could you open a JIRA for it?

I can reproduce with two users with attributes (city/country/state):

alice: dublin/ireland/abc
bob: dublin/canada/xyz

Using a FIQL of "city==dublin;country==ireland" using AnyQuery.Builder() 
correctly yields one user ("alice"). However using 
"(city==dublin,state==abc);country==ireland" yields both users incorrectly. It 
appears that it might be ignoring the country part and just returning the 
result of the brackets.

Colm.

On Thu, Sep 1, 2016 at 4:21 PM, Iurii Smyrnov 
mailto:ismyr...@talend.com>> wrote:


Hi Syncope Devs,
  Could you please check Does Syncope support braces " ( ) " in a FIQL request ?

I faced with an issue: it seems Syncope ignores braces in the request, for 
example (get groups items):
- request is : (name==testA,name==testB);name==testC
- the same request (http encoded) is: 
http://192.168.99.100:9080/syncope/rest/groups?fiql=<http://192.168.99.100:9080/syncope/rest/groups?fiql=name%3D%3DtestA%2Cname%3D%3DtestB3Bname%3D%3DtestC>%28name%3D%3DtestA%2Cname%3D%3DtestB%29%3Bname%3D%3DtestC<http://192.168.99.100:9080/syncope/rest/groups?fiql=name%3D%3DtestA%2Cname%3D%3DtestB3Bname%3D%3DtestC>

In this case response should return zero items , but it returns Group item with 
name=testA  - the same result if there would not been braces like below:
 - request is : name==testA,name==testB;name==testC or FIQL encode 
name%3D%3DtestA%2Cname%3D%3DtestB%3Bname%3D%3DtestC<http://192.168.99.100:9080/syncope/rest/groups?fiql=name%3D%3DtestA%2Cname%3D%3DtestB3Bname%3D%3DtestC>


It seems Syncope ignores braces "( )".
<http://192.168.99.100:9080/syncope/rest/groups?fiql=name%3D%3DtestA%2Cname%3D%3DtestB3Bname%3D%3DtestC>

--
Francesco Chicchiricc?

Tirasa - Open Source Excellence
http://www.tirasa.net/

Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC, Olingo PMC,
CXF Committer, OpenJPA Committer, PonyMail PPMC
http://home.apache.org/~ilgrosso/



--
Francesco Chicchiricc?

Tirasa - Open Source Excellence
http://www.tirasa.net/

Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC, Olingo PMC,
CXF Committer, OpenJPA Committer, PonyMail PPMC
http://home.apache.org/~ilgrosso/


Re: Syncope ignores braces "( )"

2016-09-02 Thread Francesco Chicchiriccò
So you are not able to access 

https://issues.apache.org/jira/secure/CreateIssue!default.jspa 

once authenticated? 

- Il 2-set-16, alle 10:56, Iurii Smyrnov  ha scritto: 

> Hi all,

> actually I just can create Service Desk Request in the Jira
> https://issues.apache.org/jira/secure/Dashboard.jspa , seems I can't create
> Issues.

> Could you please help and create the issue for this case ?

> Thanks

> Thanks,

> Iurii Smyrnov

> From: Francesco Chicchiriccò 
> Sent: Thursday, September 1, 2016 7:20:25 PM
> To: user@syncope.apache.org
> Subject: Re: Syncope ignores braces "( )"
> Hi,
> I have just tried the same sample as above and obtained the same results.

> The FIQL query is parsed into a SearchCond instance [1] by SearchCondVisitor
> [2]: at a first glance, I don't see any reason why parentheses should be
> ignored, but maybe it's only because I am quite tired at the moment :-)

> If you're opening an issue, please set "affects-version" to 2.0.0.M5 and
> "fix-for-version" to 2.0.0, thanks.

> Regards.

> [1]
> https://github.com/apache/syncope/blob/master/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/SearchCond.java
> [2]
> https://github.com/apache/syncope/blob/master/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/SearchCondVisitor.java

> On 01/09/2016 18:18, Colm O hEigeartaigh wrote:

>> Hi Iurii,

>> Yep there is an issue here. Could you open a JIRA for it?

>> I can reproduce with two users with attributes (city/country/state):

>> alice: dublin/ireland/abc
>> bob: dublin/canada/xyz

>> Using a FIQL of "city==dublin;country==ireland" using AnyQuery.Builder()
>> correctly yields one user ("alice"). However using
>> "(city==dublin,state==abc);country==ireland" yields both users incorrectly. 
>> It
>> appears that it might be ignoring the country part and just returning the
>> result of the brackets.

>> Colm.

>> On Thu, Sep 1, 2016 at 4:21 PM, Iurii Smyrnov < ismyr...@talend.com > wrote:

>>> Hi Syncope Devs,
>>> Could you please check Does Syncope support braces " ( ) " in a FIQL 
>>> request ?

>>> I faced with an issue: it seems Syncope ignores braces in the request, for
>>> example (get groups items):
>>> - request is : (name==testA,name==testB);name==testC
>>> - the same request ( http encoded ) is:
>>> http://192.168.99.100:9080/syncope/rest/groups?fiql=
>>> %28name%3D%3DtestA%2Cname%3D%3DtestB%29%3Bname%3D%3DtestC

>>> In this case response should return zero items , but it returns Group item 
>>> with
>>> name=testA - the same result if there would not been braces like below:
>>> - request is : name==testA,name==testB;name==testC or FIQL encode
>>> name%3D%3DtestA%2Cname%3D%3DtestB%3Bname%3D%3DtestC

>>> It seems Syncope ignores braces "( )".

> --
> Francesco Chicchiriccò

> Tirasa - Open Source Excellence http://www.tirasa.net/ Involved at The Apache
> Software Foundation:
> member, Syncope PMC chair, Cocoon PMC, Olingo PMC,
> CXF Committer, OpenJPA Committer, PonyMail PPMC
> http://home.apache.org/~ilgrosso/

-- 
Francesco Chicchiriccò 

Tirasa - Open Source Excellence 
http://www.tirasa.net/ 

Involved at The Apache Software Foundation: 
member, Syncope PMC chair, Cocoon PMC, Olingo PMC, 
CXF Committer, OpenJPA Committer, PonyMail PPMC 
http://home.apache.org/~ilgrosso/ 


Re: Syncope ignores braces "( )"

2016-09-02 Thread Iurii Smyrnov
Hi all,

 actually  I just can create Service Desk Request in the Jira 
https://issues.apache.org/jira/secure/Dashboard.jspa , seems I can't create 
Issues.

Could you please help and create the issue for this case ?


Thanks


[cid:f0c5b3b4-5db7-4bcb-b78a-8fb390ab73cf]


Thanks,

Iurii Smyrnov


From: Francesco Chicchiricc? 
Sent: Thursday, September 1, 2016 7:20:25 PM
To: user@syncope.apache.org
Subject: Re: Syncope ignores braces "( )"

Hi,
I have just tried the same sample as above and obtained the same results.

The FIQL query is parsed into a SearchCond instance [1] by SearchCondVisitor 
[2]: at a first glance, I don't see any reason why parentheses should be 
ignored, but maybe it's only because I am quite tired at the moment :-)

If you're opening an issue, please set "affects-version" to 2.0.0.M5 and 
"fix-for-version" to 2.0.0, thanks.

Regards.

[1] 
https://github.com/apache/syncope/blob/master/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/SearchCond.java
[2] 
https://github.com/apache/syncope/blob/master/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/SearchCondVisitor.java

On 01/09/2016 18:18, Colm O hEigeartaigh wrote:
Hi Iurii,

Yep there is an issue here. Could you open a JIRA for it?

I can reproduce with two users with attributes (city/country/state):

alice: dublin/ireland/abc
bob: dublin/canada/xyz

Using a FIQL of "city==dublin;country==ireland" using AnyQuery.Builder() 
correctly yields one user ("alice"). However using 
"(city==dublin,state==abc);country==ireland" yields both users incorrectly. It 
appears that it might be ignoring the country part and just returning the 
result of the brackets.

Colm.

On Thu, Sep 1, 2016 at 4:21 PM, Iurii Smyrnov 
mailto:ismyr...@talend.com>> wrote:

Hi Syncope Devs,
  Could you please check Does Syncope support braces " ( ) " in a FIQL request ?

I faced with an issue: it seems Syncope ignores braces in the request, for 
example (get groups items):
- request is : (name==testA,name==testB);name==testC
- the same request (http encoded) is: 
http://192.168.99.100:9080/syncope/rest/groups?fiql=<http://192.168.99.100:9080/syncope/rest/groups?fiql=name%3D%3DtestA%2Cname%3D%3DtestB3Bname%3D%3DtestC>%28name%3D%3DtestA%2Cname%3D%3DtestB%29%3Bname%3D%3DtestC<http://192.168.99.100:9080/syncope/rest/groups?fiql=name%3D%3DtestA%2Cname%3D%3DtestB3Bname%3D%3DtestC>

In this case response should return zero items , but it returns Group item with 
name=testA  - the same result if there would not been braces like below:
 - request is : name==testA,name==testB;name==testC or FIQL encode 
name%3D%3DtestA%2Cname%3D%3DtestB%3Bname%3D%3DtestC<http://192.168.99.100:9080/syncope/rest/groups?fiql=name%3D%3DtestA%2Cname%3D%3DtestB3Bname%3D%3DtestC>


It seems Syncope ignores braces "( )".
<http://192.168.99.100:9080/syncope/rest/groups?fiql=name%3D%3DtestA%2Cname%3D%3DtestB3Bname%3D%3DtestC>

--
Francesco Chicchiricc?

Tirasa - Open Source Excellence
http://www.tirasa.net/

Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC, Olingo PMC,
CXF Committer, OpenJPA Committer, PonyMail PPMC
http://home.apache.org/~ilgrosso/



Re: Syncope ignores braces "( )"

2016-09-01 Thread Francesco Chicchiriccò

Hi,
I have just tried the same sample as above and obtained the same results.

The FIQL query is parsed into a SearchCond instance [1] by 
SearchCondVisitor [2]: at a first glance, I don't see any reason why 
parentheses should be ignored, but maybe it's only because I am quite 
tired at the moment :-)


If you're opening an issue, please set "affects-version" to 2.0.0.M5 and 
"fix-for-version" to 2.0.0, thanks.


Regards.

[1] 
https://github.com/apache/syncope/blob/master/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/SearchCond.java
[2] 
https://github.com/apache/syncope/blob/master/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/SearchCondVisitor.java


On 01/09/2016 18:18, Colm O hEigeartaigh wrote:

Hi Iurii,

Yep there is an issue here. Could you open a JIRA for it?

I can reproduce with two users with attributes (city/country/state):

alice: dublin/ireland/abc
bob: dublin/canada/xyz

Using a FIQL of "city==dublin;country==ireland" using 
AnyQuery.Builder() correctly yields one user ("alice"). However using 
"(city==dublin,state==abc);country==ireland" yields both users 
incorrectly. It appears that it might be ignoring the country part and 
just returning the result of the brackets.


Colm.

On Thu, Sep 1, 2016 at 4:21 PM, Iurii Smyrnov > wrote:


Hi Syncope Devs,
Could you please check Does Syncope support braces " ( ) " in a
FIQL request ?

I faced with an issue: it seems Syncope ignores braces in the
request, for example (get groups items):
- request is : (name==testA,name==testB);name==testC
- the same request (http encoded) is:
http://192.168.99.100:9080/syncope/rest/groups?fiql=

%28name%3D%3DtestA%2Cname%3D%3DtestB%29%3Bname%3D%3DtestC



In this case response should return zero items , but it returns
Group item with name=testA  - the same result if there would not
been braces like below:
- request is : name==testA,name==testB;name==testC or FIQL encode
name%3D%3DtestA%2Cname%3D%3DtestB%3Bname%3D%3DtestC




It seems Syncope ignores braces "( )".




--
Francesco Chicchiriccò

Tirasa - Open Source Excellence
http://www.tirasa.net/

Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC, Olingo PMC,
CXF Committer, OpenJPA Committer, PonyMail PPMC
http://home.apache.org/~ilgrosso/



Re: Syncope ignores braces "( )"

2016-09-01 Thread Colm O hEigeartaigh
Hi Iurii,

Yep there is an issue here. Could you open a JIRA for it?

I can reproduce with two users with attributes (city/country/state):

alice: dublin/ireland/abc
bob: dublin/canada/xyz

Using a FIQL of "city==dublin;country==ireland" using AnyQuery.Builder()
correctly yields one user ("alice"). However using
"(city==dublin,state==abc);country==ireland" yields both users incorrectly.
It appears that it might be ignoring the country part and just returning
the result of the brackets.

Colm.

On Thu, Sep 1, 2016 at 4:21 PM, Iurii Smyrnov  wrote:

> Hi Syncope Devs,
>   Could you please check Does Syncope support braces " ( ) " in a
> FIQL request ?
>
> I faced with an issue: it seems Syncope ignores braces in the request, for
> example (get groups items):
> - request is : (name==testA,name==testB);name==testC
> - the same request (http encoded) is: http://192.
> 168.99.100:9080/syncope/rest/groups?fiql=
> 
> %28name%3D%3DtestA%2Cname%3D%3DtestB%29%3Bname%3D%3DtestC
> 
> 
>
> In this case response should return zero items , but it returns Group item
> with name=testA  - the same result if there would not been braces like
> below:
>  - request is : name==testA,name==testB;name==testC or FIQL encode
> name%3D%3DtestA%2Cname%3D%3DtestB%3Bname%3D%3DtestC
> 
>
>
> It seems Syncope ignores braces "( )".
>
> 
>
> Thanks,
> Iurii Smyrnov
> Software Developer
> ismyr...@talend.com
>
>


-- 
Colm O hEigeartaigh

Talend Community Coder
http://coders.talend.com