[Bps-public-commit] rt-extension-rightsdebugger branch, master, updated. 39dd802256ab79c394966156be2f0afd1fc7fe56
Shawn Moore
shawn at bestpractical.com
Thu Mar 16 14:20:15 EDT 2017
The branch, master has been updated
via 39dd802256ab79c394966156be2f0afd1fc7fe56 (commit)
from c8177b6892339b6ac769e37589ccc257d79d4c06 (commit)
Summary of changes:
lib/RT/Extension/RightsDebugger.pm | 33 +++++++++++++++++----------------
1 file changed, 17 insertions(+), 16 deletions(-)
- Log -----------------------------------------------------------------
commit 39dd802256ab79c394966156be2f0afd1fc7fe56
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Thu Mar 16 18:20:09 2017 +0000
Improve parenthesization
diff --git a/lib/RT/Extension/RightsDebugger.pm b/lib/RT/Extension/RightsDebugger.pm
index a2a4966..9761e6a 100644
--- a/lib/RT/Extension/RightsDebugger.pm
+++ b/lib/RT/Extension/RightsDebugger.pm
@@ -337,8 +337,6 @@ sub Search {
);
}
- my $search_paren;
-
if ($args{object}) {
if (my ($type, $identifier) = $args{object} =~ m{
^
@@ -362,26 +360,29 @@ sub Search {
$primary_records{object} = $record;
for my $obj ($record, $record->ACLEquivalenceObjects, RT->System) {
- $search_paren ||= do { $ACL->_OpenParen('search'); 1 };
+ $ACL->_OpenParen('object');
$ACL->Limit(
- SUBCLAUSE => 'search',
+ SUBCLAUSE => 'object',
FIELD => 'ObjectType',
OPERATOR => '=',
VALUE => ref($obj),
ENTRYAGGREGATOR => 'OR',
);
$ACL->Limit(
- SUBCLAUSE => 'search',
+ SUBCLAUSE => 'object',
FIELD => 'ObjectId',
OPERATOR => '=',
VALUE => $obj->Id,
QUOTEVALUE => 0,
ENTRYAGGREGATOR => 'AND',
);
+ $ACL->_CloseParen('object');
}
}
}
+ my $principal_paren = 0;
+
if ($args{principal}) {
if (my ($type, $identifier) = $args{principal} =~ m{
^
@@ -417,18 +418,19 @@ sub Search {
TABLE2 => 'CachedGroupMembers',
FIELD2 => 'GroupId',
);
- $search_paren ||= do { $ACL->_OpenParen('search'); 1 };
+ $ACL->_OpenParen('principal');
+ $principal_paren = 1;
$ACL->Limit(
- SUBCLAUSE => 'search',
ALIAS => $cgm_alias,
+ SUBCLAUSE => 'principal',
FIELD => 'Disabled',
QUOTEVALUE => 0,
VALUE => 0,
ENTRYAGGREGATOR => 'AND',
);
$ACL->Limit(
- SUBCLAUSE => 'search',
ALIAS => $cgm_alias,
+ SUBCLAUSE => 'principal',
FIELD => 'MemberId',
VALUE => $principal->Id,
QUOTEVALUE => 0,
@@ -458,9 +460,13 @@ sub Search {
$inner_role{$acl_id} = [$inner_class, $record_id, $other_count];
}
if (@acl_ids) {
- $search_paren ||= do { $ACL->_OpenParen('search'); 1 };
+ if (!$principal_paren) {
+ $ACL->_OpenParen('principal');
+ $principal_paren = 1;
+ }
+
$ACL->Limit(
- SUBCLAUSE => 'search',
+ SUBCLAUSE => 'principal',
FIELD => 'id',
OPERATOR => 'IN',
VALUE => \@acl_ids,
@@ -470,21 +476,16 @@ sub Search {
}
}
- if ($search_paren) {
- $ACL->_CloseParen('search');
- }
+ $ACL->_CloseParen('principal') if $principal_paren;
if ($args{continueAfter}) {
$has_search = 1;
- $ACL->_OpenParen('paging');
$ACL->Limit(
- SUBCLAUSE => 'paging',
FIELD => 'id',
OPERATOR => '>',
VALUE => int($args{continueAfter}),
QUOTEVALUE => 0,
);
- $ACL->_CloseParen('paging');
}
$ACL->OrderBy(
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list