User tenancy verification - UI entry point

Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/d7e77e33
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/d7e77e33
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/d7e77e33

Branch: refs/heads/master
Commit: d7e77e33a3b2968c7983baf8c19719e12b9c740c
Parents: e5ddf16
Author: nir-sopher <n...@qwilt.com>
Authored: Wed Jun 14 18:11:15 2017 +0300
Committer: Jeremy Mitchell <mitchell...@gmail.com>
Committed: Wed Jul 19 15:55:31 2017 -0600

----------------------------------------------------------------------
 traffic_ops/app/lib/UI/Cdn.pm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d7e77e33/traffic_ops/app/lib/UI/Cdn.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/UI/Cdn.pm b/traffic_ops/app/lib/UI/Cdn.pm
index a8e00ab..82aaa53 100644
--- a/traffic_ops/app/lib/UI/Cdn.pm
+++ b/traffic_ops/app/lib/UI/Cdn.pm
@@ -27,6 +27,7 @@ use JSON;
 use Hash::Merge qw(merge);
 use String::CamelCase qw(decamelize);
 use DBI;
+use Utils::Tenant;
 
 # Yes or no
 my %yesno = ( 0 => "no", 1 => "yes", 2 => "no" );
@@ -648,8 +649,13 @@ sub auser {
 
     my $rs = $self->db->resultset('TmUser')->search( undef, { prefetch => [ { 
'role' => undef } ] } );
 
-    while ( my $row = $rs->next ) {
+    my $tenant_utils = Utils::Tenant->new($self);
+    my $tenants_data = $tenant_utils->create_tenants_data_from_db();
 
+    while ( my $row = $rs->next ) {
+        if (!$tenant_utils->is_user_resource_accessible($tenants_data, 
$row->tenant_id)) {
+            next;
+        }
         my @line = [
             $row->id,           $row->username, $row->role->name, 
$row->full_name, $row->company,   $row->email,
             $row->phone_number, $row->uid,      $row->gid,        \1,          
    \$row->new_user, $row->last_updated

Reply via email to