Hi Francesco,
I've created this PR https://github.com/apache/syncope/pull/40.
Be aware that :
1. it's a global case insentive flag (and not a fiql operator). There were 2
reasons for this: * creating a custom fiql operator isn't possible for the
moment without either modifying cxf fiql parser or writing another (which would
be a pity). * I had some exchanges with Sergey on case-insensitivity search .
His view on this case in/sensitivity issue is that it can be resolved by
configuration (I took this approach - easier :) ). After looking a bit SCIM
spec, https://tools.ietf.org/html/rfc7643, there's a lot (majority) of fields
with caseExact=false. So on second thought I think too that we can live with a
global flag.Just let me know if this limitation is ok for you.
I not, we'll need to add some more exchanges with Sergey or you'll need to show
me how you could use custom fiql operators, because I don't see them.
2. case insensitivity is only implemented for fiql search.Let me know if you
think that we need also implement it in other search (I think only
groupDao.findByXXX, userDao.findByXXX would need).
Also just let me know if you see anything in this PR that's not ok for you !
Thanks,Adrian
De : Francesco Chicchiriccò <[email protected]>
À : [email protected]
Envoyé le : Lundi 21 novembre 2016 16h31
Objet : Re: User case insensitive search
On 21/11/2016 16:29, Francesco Chicchiriccò wrote:
On 21/11/2016 14:00, Francesco Chicchiriccò wrote:
On 21/11/2016 13:47, Adrian Gonzalez wrote:
Hi Francesco,
Cool, I've just created SYNCOPE-971.
> the problem is that, as far as I can tell, such clauses are DBMS-dependent.
We can solve it using jpql LOWER ou UPPER function, i.e.
LOWER(givenName) = LOWER('Martin')
I can try to implement it, but I don't know for now if it is possible to
introduce either : * custom operator in FIQL (i.e. some eqi operator like :
givenName eqi Martin) * introduce custom functions in FIQL (i.e. uc(givenName)
== uc(Martin))
I would rather go with first (we also have other custom operators).
Essentially, I see two separate tasks here:
1. extend FIQL, the query builders and the logic that transforms FIQL queries
into the low-level search objects
2. extend JPAAnySearchDAO to take care of such new EQI comparator, similarly
to what is currently done at
https://github.com/apache/syncope/blob/2_0_X/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java#L782-L790
The only non-obvious problem I see is that we will need to make the new code
RDBMS provider dependent.
Sorry, totally missed your statement above about using JPQL's LOWER() or
UPPER() - smart move ;-)
Sorry again: the problem is that queries built by JPASearchDAO are native
query, not JPQL.
Regards.
De : Francesco Chicchiriccò <[email protected]>
À : [email protected]
Envoyé le : Lundi 21 novembre 2016 13h25
Objet : Re: User case insensitive search
On 21/11/2016 12:59, Adrian Gonzalez wrote:
Hello,
I'd like to execute a case insensitive search in Syncope.
i.e. querying all users with an attribute givenName that matches 'martin'
would return : Martin martin mArtin
Is there a way to do this with a Fiql search ? i.e. something like
UPPER(givenName) = UPPER('martin') ?
If no are there other ways to do this ? If no, I can always store givenName
attribute in 2 different attributes (i.e. the real givenName attribute and a
givenNameCaseInsensitive attribute to store it in lowercase), but I would like
to avoid it if possible.
Hi Adrian,
I confirm that currently it is *not* possible to perform case insensitive
searches.
Nevertheless, it would be a nice feature to add: essentially, one should be
adding 'lowercase()' clauses to the native SQL queries manage by [1]: the
problem is that, as far as I can tell, such clauses are DBMS-dependent.
Would you mind creating an improvement on JIRA for this?
Naturally, contributions are welcome ;-)
Regards.
[1]
https://github.com/apache/syncope/blob/2_0_X/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java
--
Francesco Chicchiriccò
Tirasa - Open Source Excellence
http://www.tirasa.net/
Member at The Apache Software Foundation
Syncope, Cocoon, Olingo, CXF, OpenJPA, PonyMail
http://home.apache.org/~ilgrosso/