[Bps-public-commit] rt-extension-rightsdebugger branch, master, updated. 61f93dc28e46b888c0f0d209d142c954f848051e
Shawn Moore
shawn at bestpractical.com
Tue Mar 7 14:01:02 EST 2017
The branch, master has been updated
via 61f93dc28e46b888c0f0d209d142c954f848051e (commit)
via dd3e2d256b6af0272f69c04e3b6b7c827417d0f3 (commit)
via 6cba500a581c8e3f521fe3550241b83729f555e3 (commit)
from 78eacafa3fc8d203d089693eca2ba23cdb389819 (commit)
Summary of changes:
html/Admin/RightsDebugger/index.html | 2 +-
lib/RT/Extension/RightsDebugger.pm | 46 +++++++++++++++++++++++++++---------
static/css/rights-debugger.css | 4 ++++
3 files changed, 40 insertions(+), 12 deletions(-)
- Log -----------------------------------------------------------------
commit 6cba500a581c8e3f521fe3550241b83729f555e3
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Tue Mar 7 18:48:02 2017 +0000
Implicitly include SuperUser whenever limiting rights
Better to include it when it's not wanted than to exclude it causing confusion
diff --git a/lib/RT/Extension/RightsDebugger.pm b/lib/RT/Extension/RightsDebugger.pm
index 12c8922..edca86b 100644
--- a/lib/RT/Extension/RightsDebugger.pm
+++ b/lib/RT/Extension/RightsDebugger.pm
@@ -175,6 +175,12 @@ sub Search {
ENTRYAGGREGATOR => 'OR',
);
}
+ $ACL->Limit(
+ FIELD => 'RightName',
+ OPERATOR => '=',
+ VALUE => 'SuperUser',
+ ENTRYAGGREGATOR => 'OR',
+ );
}
if ($args{continueAfter}) {
commit dd3e2d256b6af0272f69c04e3b6b7c827417d0f3
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Tue Mar 7 18:51:42 2017 +0000
Render primary record recursively
diff --git a/html/Admin/RightsDebugger/index.html b/html/Admin/RightsDebugger/index.html
index 12f694e..e778563 100644
--- a/html/Admin/RightsDebugger/index.html
+++ b/html/Admin/RightsDebugger/index.html
@@ -32,7 +32,7 @@
{{#if primary_record}}
<span class="primary">
- Contains {{primary_record.label}}
+ Contains {{> render_record primary_record}}
</span>
{{/if}}
</span>
diff --git a/lib/RT/Extension/RightsDebugger.pm b/lib/RT/Extension/RightsDebugger.pm
index edca86b..1376b32 100644
--- a/lib/RT/Extension/RightsDebugger.pm
+++ b/lib/RT/Extension/RightsDebugger.pm
@@ -45,18 +45,20 @@ sub _HighlightSerializedForSearch {
$serialized->{right_highlighted} = _HighlightTerm($serialized->{right}, join '|', @{ $search->{right} || [] });
for my $key (qw/principal object/) {
- my $record = $serialized->{$key};
+ for my $record ($serialized->{$key}, $serialized->{$key}->{primary_record}) {
+ next if !$record;
- if (my $matchers = $search->{$key}) {
- my $re = join '|', @$matchers;
- for my $column (qw/label detail/) {
- $record->{$column . '_highlighted'} = _HighlightTerm($record->{$column}, $re);
+ if (my $matchers = $search->{$key}) {
+ my $re = join '|', @$matchers;
+ for my $column (qw/label detail/) {
+ $record->{$column . '_highlighted'} = _HighlightTerm($record->{$column}, $re);
+ }
}
- }
- for my $column (qw/label detail/) {
- # make sure we escape html if there was no search
- $record->{$column . '_highlighted'} //= _EscapeHTML($record->{$column});
+ for my $column (qw/label detail/) {
+ # make sure we escape html if there was no search
+ $record->{$column . '_highlighted'} //= _EscapeHTML($record->{$column});
+ }
}
}
diff --git a/static/css/rights-debugger.css b/static/css/rights-debugger.css
index 0afae25..e8e0a24 100644
--- a/static/css/rights-debugger.css
+++ b/static/css/rights-debugger.css
@@ -72,3 +72,7 @@
font-style: italic;
display: block;
}
+
+#rights-debugger .results .result .primary .detail {
+ display: none;
+}
commit 61f93dc28e46b888c0f0d209d142c954f848051e
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Tue Mar 7 19:00:43 2017 +0000
Avoid including primary record when it's equivalent to listed record
diff --git a/lib/RT/Extension/RightsDebugger.pm b/lib/RT/Extension/RightsDebugger.pm
index 1376b32..89b36b5 100644
--- a/lib/RT/Extension/RightsDebugger.pm
+++ b/lib/RT/Extension/RightsDebugger.pm
@@ -288,10 +288,9 @@ sub DisableRevoke {
return 0;
}
-sub SerializeRecord {
+sub CanonicalizeRecord {
my $self = shift;
my $record = shift;
- my $primary_record = shift;
return undef unless $record;
@@ -315,6 +314,23 @@ sub SerializeRecord {
}
}
+ return $record;
+}
+
+sub SerializeRecord {
+ my $self = shift;
+ my $record = shift;
+ my $primary_record = shift;
+
+ return undef unless $record;
+
+ $record = $self->CanonicalizeRecord($record);
+ $primary_record = $self->CanonicalizeRecord($primary_record);
+
+ undef $primary_record if $primary_record
+ && ref($record) eq ref($primary_record)
+ && $record->Id == $primary_record->Id;
+
my $serialized = {
class => ref($record),
id => $record->id,
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list