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

Shawn Moore shawn at bestpractical.com
Tue Feb 28 16:19:17 EST 2017


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

Summary of changes:
 html/Admin/RightsDebugger/index.html | 10 +++++-----
 html/Helpers/RightsDebugger/Search   | 12 +++++++-----
 2 files changed, 12 insertions(+), 10 deletions(-)

- Log -----------------------------------------------------------------
commit c4ea4ca11b2e0ba159b336fd3b548758fb0898cf
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Tue Feb 28 21:12:49 2017 +0000

    Highlight principal and object search term

diff --git a/html/Admin/RightsDebugger/index.html b/html/Admin/RightsDebugger/index.html
index d9aec54..01b2328 100644
--- a/html/Admin/RightsDebugger/index.html
+++ b/html/Admin/RightsDebugger/index.html
@@ -14,18 +14,18 @@
 
 <script type="text/x-template" id="debugger-record-template">
   {{#if url}}
-      <a target="_blank" href="{{url}}">{{label}}</a>
+      <a target="_blank" href="{{url}}">{{search_highlight label search}}</a>
   {{else}}
-      {{label}}
+      {{search_highlight label search}}
   {{/if}}
 
-  <span class="detail">{{detail}}</span>
+  <span class="detail">{{search_highlight detail search}}</span>
 </script>
 
 <script type="text/x-template" id="debugger-result-template">
   <div class="result">
-    <div class="principal cell">{{> render_record item.principal}}</div>
-    <div class="object cell">{{> render_record item.object}}</div>
+    <div class="principal cell">{{> render_record item.principal search=search.principal}}</div>
+    <div class="object cell">{{> render_record item.object search=search.object}}</div>
     <div class="right cell">{{search_highlight item.right search.right}}</div>
     <div class="revoke cell">
         <button data-action="<%RT->Config->Get('WebPath')%>/Helpers/RightsDebugger/Revoke?id={{item.ace.id}}" {{#if item.disable_revoke}}class="ui-state-disabled" disabled="disabled"{{/if}}>Revoke</button>

commit a3bdf4d6b9450b3e9f3d2f5c20dcd3a6e193e790
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Tue Feb 28 21:12:57 2017 +0000

    Multi-word search

diff --git a/html/Helpers/RightsDebugger/Search b/html/Helpers/RightsDebugger/Search
index 6c52647..0857251 100644
--- a/html/Helpers/RightsDebugger/Search
+++ b/html/Helpers/RightsDebugger/Search
@@ -23,12 +23,14 @@ ACE: while (my $ACE = $ACL->Next) {
     # 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;
+            for my $word (split ' ', $search) {
+                my $re = qr/\Q$word\E/i;
+                next ACE unless $record->{class}  =~ $re
+                             || $record->{id}     =~ $re
+                             || $record->{label}  =~ $re
+                             || $record->{detail} =~ $re;
+            }
         }
     }
 

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


More information about the Bps-public-commit mailing list