[jira] [Created] (SYNCOPE-1664) Inconsistent search query when is used a pull correlation rule

2022-02-24 Thread Samuel Garofalo (Jira)
Samuel Garofalo created SYNCOPE-1664:


 Summary: Inconsistent search query when is used a pull correlation 
rule
 Key: SYNCOPE-1664
 URL: https://issues.apache.org/jira/browse/SYNCOPE-1664
 Project: Syncope
  Issue Type: Bug
  Components: core
Affects Versions: 2.1.10, 3.0.0
Reporter: Samuel Garofalo
 Fix For: 2.1.11, 3.0.0


# Create an AnyObject with at least 2 plain attributes, the name of the 
AnyObject must be the concatenation of the values of the two attributes 
separated by a character like '_'. In the second AnyObject the value of the 
first attribute must contains the value of the first attribute of the first 
AnyObject.
 # Create a pull correlation rule using 2 plain attributes for the created 
AnyObject and assign that on a resource.
 # Pull the AnyObjects from the choosen resource.
 # Having a pull correlation rule the created query use a like_regex and during 
the pull of the first AnyObject both the AnyObjects will match the query 
generating a remediation.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Updated] (SYNCOPE-1664) JSONB: Inconsistent search query when is used a pull correlation rule

2022-02-24 Thread Jira


 [ 
https://issues.apache.org/jira/browse/SYNCOPE-1664?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Francesco Chicchiriccò updated SYNCOPE-1664:

Summary: JSONB: Inconsistent search query when is used a pull correlation 
rule  (was: Inconsistent search query when is used a pull correlation rule)

> JSONB: Inconsistent search query when is used a pull correlation rule
> -
>
> Key: SYNCOPE-1664
> URL: https://issues.apache.org/jira/browse/SYNCOPE-1664
> Project: Syncope
>  Issue Type: Bug
>  Components: core
>Affects Versions: 2.1.10, 3.0.0
>Reporter: Samuel Garofalo
>Priority: Major
>  Labels: jsonb, postgresql
> Fix For: 2.1.11, 3.0.0
>
>
> # Create an AnyObject with at least 2 plain attributes, the name of the 
> AnyObject must be the concatenation of the values of the two attributes 
> separated by a character like '_'. In the second AnyObject the value of the 
> first attribute must contains the value of the first attribute of the first 
> AnyObject.
>  # Create a pull correlation rule using 2 plain attributes for the created 
> AnyObject and assign that on a resource.
>  # Pull the AnyObjects from the choosen resource.
>  # Having a pull correlation rule the created query use a like_regex and 
> during the pull of the first AnyObject both the AnyObjects will match the 
> query generating a remediation.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Updated] (SYNCOPE-1664) Inconsistent search query when is used a pull correlation rule

2022-02-24 Thread Jira


 [ 
https://issues.apache.org/jira/browse/SYNCOPE-1664?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Francesco Chicchiriccò updated SYNCOPE-1664:

Labels: jsonb postgresql  (was: )

> Inconsistent search query when is used a pull correlation rule
> --
>
> Key: SYNCOPE-1664
> URL: https://issues.apache.org/jira/browse/SYNCOPE-1664
> Project: Syncope
>  Issue Type: Bug
>  Components: core
>Affects Versions: 2.1.10, 3.0.0
>Reporter: Samuel Garofalo
>Priority: Major
>  Labels: jsonb, postgresql
> Fix For: 2.1.11, 3.0.0
>
>
> # Create an AnyObject with at least 2 plain attributes, the name of the 
> AnyObject must be the concatenation of the values of the two attributes 
> separated by a character like '_'. In the second AnyObject the value of the 
> first attribute must contains the value of the first attribute of the first 
> AnyObject.
>  # Create a pull correlation rule using 2 plain attributes for the created 
> AnyObject and assign that on a resource.
>  # Pull the AnyObjects from the choosen resource.
>  # Having a pull correlation rule the created query use a like_regex and 
> during the pull of the first AnyObject both the AnyObjects will match the 
> query generating a remediation.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[GitHub] [syncope] ilgrosso commented on a change in pull request #317: [SYNCOPE-1664] JSONB: Inconsistent search query when is used a pull correlation rule

2022-02-24 Thread GitBox


ilgrosso commented on a change in pull request #317:
URL: https://github.com/apache/syncope/pull/317#discussion_r813711581



##
File path: 
core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/PGJPAJSONAnySearchDAO.java
##
@@ -200,8 +200,11 @@ protected void fillAttrQuery(
 case EQ:
 
query.append("jsonb_path_exists(").append(schema.getKey()).append(", '$[*] ? ").
 append("(@.").append(key);
-if (isStr) {
+if (POSTGRESQL_REGEX_CHARS.chars().mapToObj(c -> (char) c).
+anyMatch(c -> value.indexOf(c) > -1) || lower) {
 query.append(" like_regex 
\"").append(escapeForLikeRegex(value).replace("'", "''")).append('"');
+} else if (isStr) {
+query.append(" == \"").append(value).append('"');

Review comment:
   Don't wrap string argument with quotes `"` but single quotes `'`, e.g.
   
   ```
   query.append(" == '").append(value).append("'");
   ```

##
File path: 
core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/PGJPAJSONAnySearchDAO.java
##
@@ -200,8 +200,11 @@ protected void fillAttrQuery(
 case EQ:
 
query.append("jsonb_path_exists(").append(schema.getKey()).append(", '$[*] ? ").
 append("(@.").append(key);
-if (isStr) {
+if (POSTGRESQL_REGEX_CHARS.chars().mapToObj(c -> (char) c).

Review comment:
   Replace this condition with simpler
   
   ```
   if (StringUtils.containsAny(value, 
POSTGRESQL_REGEX_CHARS) || lower) {
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@syncope.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[jira] [Assigned] (SYNCOPE-1664) JSONB: Inconsistent search query when is used a pull correlation rule

2022-02-24 Thread Jira


 [ 
https://issues.apache.org/jira/browse/SYNCOPE-1664?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Francesco Chicchiriccò reassigned SYNCOPE-1664:
---

Assignee: Francesco Chicchiriccò

> JSONB: Inconsistent search query when is used a pull correlation rule
> -
>
> Key: SYNCOPE-1664
> URL: https://issues.apache.org/jira/browse/SYNCOPE-1664
> Project: Syncope
>  Issue Type: Bug
>  Components: core
>Affects Versions: 2.1.10, 3.0.0
>Reporter: Samuel Garofalo
>Assignee: Francesco Chicchiriccò
>Priority: Major
>  Labels: jsonb, postgresql
> Fix For: 2.1.11, 3.0.0
>
>
> # Create an AnyObject with at least 2 plain attributes, the name of the 
> AnyObject must be the concatenation of the values of the two attributes 
> separated by a character like '_'. In the second AnyObject the value of the 
> first attribute must contains the value of the first attribute of the first 
> AnyObject.
>  # Create a pull correlation rule using 2 plain attributes for the created 
> AnyObject and assign that on a resource.
>  # Pull the AnyObjects from the choosen resource.
>  # Having a pull correlation rule the created query use a like_regex and 
> during the pull of the first AnyObject both the AnyObjects will match the 
> query generating a remediation.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[GitHub] [syncope] ilgrosso commented on pull request #317: [SYNCOPE-1664] JSONB: Inconsistent search query when is used a pull correlation rule

2022-02-24 Thread GitBox


ilgrosso commented on pull request #317:
URL: https://github.com/apache/syncope/pull/317#issuecomment-1049703894


   @SamuelGaro there are a few test cases failing: 
https://github.com/apache/syncope/runs/5317086137?check_suite_focus=true#step:6:3403


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@syncope.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [syncope] SamuelGaro commented on pull request #317: [SYNCOPE-1664] JSONB: Inconsistent search query when is used a pull correlation rule

2022-02-24 Thread GitBox


SamuelGaro commented on pull request #317:
URL: https://github.com/apache/syncope/pull/317#issuecomment-1049705595


   > @SamuelGaro there are a few test cases failing: 
https://github.com/apache/syncope/runs/5317086137?check_suite_focus=true#step:6:3403
   
   @ilgrosso I'm going to check


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@syncope.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [syncope] ilgrosso merged pull request #317: [SYNCOPE-1664] JSONB: Inconsistent search query when is used a pull correlation rule

2022-02-24 Thread GitBox


ilgrosso merged pull request #317:
URL: https://github.com/apache/syncope/pull/317


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@syncope.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[jira] [Commented] (SYNCOPE-1664) JSONB: Inconsistent search query when is used a pull correlation rule

2022-02-24 Thread ASF subversion and git services (Jira)


[ 
https://issues.apache.org/jira/browse/SYNCOPE-1664?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17497564#comment-17497564
 ] 

ASF subversion and git services commented on SYNCOPE-1664:
--

Commit 4581c9ca0f567eef32586073d8c4d9718c1827bb in syncope's branch 
refs/heads/master from SamuelGaro
[ https://gitbox.apache.org/repos/asf?p=syncope.git;h=4581c9c ]

[SYNCOPE-1664] JSONB: Inconsistent search query when is used a pull correlation 
rule (#317)



> JSONB: Inconsistent search query when is used a pull correlation rule
> -
>
> Key: SYNCOPE-1664
> URL: https://issues.apache.org/jira/browse/SYNCOPE-1664
> Project: Syncope
>  Issue Type: Bug
>  Components: core
>Affects Versions: 2.1.10, 3.0.0
>Reporter: Samuel Garofalo
>Assignee: Francesco Chicchiriccò
>Priority: Major
>  Labels: jsonb, postgresql
> Fix For: 2.1.11, 3.0.0
>
>
> # Create an AnyObject with at least 2 plain attributes, the name of the 
> AnyObject must be the concatenation of the values of the two attributes 
> separated by a character like '_'. In the second AnyObject the value of the 
> first attribute must contains the value of the first attribute of the first 
> AnyObject.
>  # Create a pull correlation rule using 2 plain attributes for the created 
> AnyObject and assign that on a resource.
>  # Pull the AnyObjects from the choosen resource.
>  # Having a pull correlation rule the created query use a like_regex and 
> during the pull of the first AnyObject both the AnyObjects will match the 
> query generating a remediation.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[GitHub] [syncope] ilgrosso commented on pull request #317: [SYNCOPE-1664] JSONB: Inconsistent search query when is used a pull correlation rule

2022-02-24 Thread GitBox


ilgrosso commented on pull request #317:
URL: https://github.com/apache/syncope/pull/317#issuecomment-1050067924


   LGTM thanks @SamuelGaro - please open a similar PR for `2_1_X` thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@syncope.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org