[Bps-public-commit] rt-extension-rightsdebugger branch, master, updated. 3637f85d3874fe3b41f19da5f07047d2e9637085

Shawn Moore shawn at bestpractical.com
Tue Feb 28 16:06:42 EST 2017


The branch, master has been updated
       via  3637f85d3874fe3b41f19da5f07047d2e9637085 (commit)
      from  f27424ae387fe09df25b5bcd19cff6edc4535709 (commit)

Summary of changes:
 html/Helpers/RightsDebugger/Search | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit 3637f85d3874fe3b41f19da5f07047d2e9637085
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Tue Feb 28 21:00:14 2017 +0000

    Basic filtering implementation

diff --git a/html/Helpers/RightsDebugger/Search b/html/Helpers/RightsDebugger/Search
index 8515674..6c52647 100644
--- a/html/Helpers/RightsDebugger/Search
+++ b/html/Helpers/RightsDebugger/Search
@@ -17,8 +17,22 @@ if ($ARGS{right}) {
 
 $ACL->UnLimit unless $has_search;
 
-while (my $ACE = $ACL->Next) {
-    push @results, RT::Extension::RightsDebugger->SerializeACE($ACE);
+ACE: while (my $ACE = $ACL->Next) {
+    my $serialized = RT::Extension::RightsDebugger->SerializeACE($ACE);
+
+    # this is hacky, but doing the searching in SQL is absolutely a nonstarter
+    for my $key (qw/principal object/) {
+        if (my $search = $ARGS{$key}) {
+            my $re = qr/\Q$search\E/i;
+            my $record = $serialized->{$key};
+            next ACE unless $record->{class}  =~ $re
+                         || $record->{id}     =~ $re
+                         || $record->{label}  =~ $re
+                         || $record->{detail} =~ $re;
+        }
+    }
+
+    push @results, $serialized;
 }
 
 $r->content_type('application/json; charset=utf-8');

-----------------------------------------------------------------------


More information about the Bps-public-commit mailing list