[Bps-public-commit] rt-extension-rest2 branch, master, updated. 854dc305cfe45710fd992151ad4445e18c51cdf9

Shawn Moore shawn at bestpractical.com
Tue Dec 13 17:43:01 EST 2016


The branch, master has been updated
       via  854dc305cfe45710fd992151ad4445e18c51cdf9 (commit)
      from  dcbd85d4070078ff4b45a30ed5ae054f4bea5408 (commit)

Summary of changes:
 lib/RT/Extension/REST2/Util.pm |  2 +-
 t/queues.t                     | 14 ++++----------
 2 files changed, 5 insertions(+), 11 deletions(-)

- Log -----------------------------------------------------------------
commit 854dc305cfe45710fd992151ad4445e18c51cdf9
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Tue Dec 13 22:33:46 2016 +0000

    Avoid including fields for ACL-only roles
    
    Queues have a concept of Owner and Requestor only to provide ACLs; there are
    no actual Owners or Requestors at a queue level. And so filter out these
    ACL-only roles from being serialized.

diff --git a/lib/RT/Extension/REST2/Util.pm b/lib/RT/Extension/REST2/Util.pm
index fcb98f8..b455389 100644
--- a/lib/RT/Extension/REST2/Util.pm
+++ b/lib/RT/Extension/REST2/Util.pm
@@ -76,7 +76,7 @@ sub serialize_record {
 
     # Include role members, if applicable
     if ($record->DOES("RT::Record::Role::Roles")) {
-        for my $role ($record->Roles) {
+        for my $role ($record->Roles(ACLOnly => 0)) {
             my $members = $data{$role} = [];
             my $group = $record->RoleGroup($role);
             my $gm = $group->MembersObj;
diff --git a/t/queues.t b/t/queues.t
index 9be5138..a654c80 100644
--- a/t/queues.t
+++ b/t/queues.t
@@ -69,11 +69,8 @@ my $queue_url;
     is_deeply($content->{Cc}, [], 'no Ccs set');
     is_deeply($content->{AdminCc}, [], 'no AdminCcs set');
 
-    TODO: {
-        local $TODO = "need to filter out ticket-level roles";
-        ok(!exists($content->{Owner}), 'no Owner at the queue level');
-        ok(!exists($content->{Requestor}), 'no Requestor at the queue level');
-    }
+    ok(!exists($content->{Owner}), 'no Owner at the queue level');
+    ok(!exists($content->{Requestor}), 'no Requestor at the queue level');
 }
 
 # Queue update
@@ -201,11 +198,8 @@ my ($features_url, $features_id);
     is_deeply($content->{Cc}, [], 'no Ccs set');
     is_deeply($content->{AdminCc}, [], 'no AdminCcs set');
 
-    TODO: {
-        local $TODO = "need to filter out ticket-level roles";
-        ok(!exists($content->{Owner}), 'no Owner at the queue level');
-        ok(!exists($content->{Requestor}), 'no Requestor at the queue level');
-    }
+    ok(!exists($content->{Owner}), 'no Owner at the queue level');
+    ok(!exists($content->{Requestor}), 'no Requestor at the queue level');
 }
 
 # id > 0 (finds new Features queue but not disabled Bugs queue)

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


More information about the Bps-public-commit mailing list