diff options
author | Jeff Fearn <jfearn@redhat.com> | 2021-02-02 14:58:43 +1000 |
---|---|---|
committer | Jeff Fearn <jfearn@redhat.com> | 2021-02-02 14:58:43 +1000 |
commit | 813b19c26677aeb22d978b8f1c3e76d611893f0b (patch) | |
tree | aa8f29e7aaaac94435d1dcf92d22846660fe011a | |
parent | Bug 1882200 - Let BRE specify which groups private comment can be seen by (diff) | |
download | bugzilla-813b19c26677aeb22d978b8f1c3e76d611893f0b.tar.gz bugzilla-813b19c26677aeb22d978b8f1c3e76d611893f0b.tar.bz2 bugzilla-813b19c26677aeb22d978b8f1c3e76d611893f0b.zip |
Bug 1923261 - Recursive Action Detection having false positives
Handle adding Vs removing values.
Change-Id: I936167d5b9e998edfecf956d5b809cd4dab02876
-rw-r--r-- | extensions/RuleEngine/lib/Pages.pm | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/extensions/RuleEngine/lib/Pages.pm b/extensions/RuleEngine/lib/Pages.pm index 0014deb63..1066109b1 100644 --- a/extensions/RuleEngine/lib/Pages.pm +++ b/extensions/RuleEngine/lib/Pages.pm @@ -1275,19 +1275,33 @@ sub _rule_cgi_to_array { } } if (ref($match->{$field}{values}) eq 'ARRAY') { - # There needs to be at least 1 value we are setting that we aren't matching - # BUGBUG is this bugged? The check should vary if we are checking if it's set Vs if it isn't? - # e.g. if we check it isn't set, then we add it, the check should pass... my $lc = List::Compare->new( \@{$match->{$field}{values}}, \@{$action->{$field}{values}} ); - my @not_in_match = $lc->get_complement; - - unless (@not_in_match) { - push(@errors, - {'field' => $field, 'value' => join(' ', @{$action->{$field}{values}})}); + if ( $cond =~ m/^(?:Set|Add)$/i + && exists $match->{$field}{word} + && $match->{$field}{word} =~ m/^(?:is not any of)$/i) + { + # There needs to be at least 1 value we are setting that we are + # checking isn't set + my @in_match = $lc->get_intersection; + + unless (@in_match) { + push(@errors, + {'field' => $field, 'value' => join(' ', @{$action->{$field}{values}})}); + } + } + else { + # There needs to be at least 1 value we are removing that we are + # checking is set + my @not_in_match = $lc->get_complement; + + unless (@not_in_match) { + push(@errors, + {'field' => $field, 'value' => join(' ', @{$action->{$field}{values}})}); + } } } elsif ( |