Tenant utils - rebase fixes

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

Branch: refs/heads/master
Commit: 90612170441e3400fef3fb3271234184dffa0c29
Parents: f35a77f
Author: nir-sopher <[email protected]>
Authored: Mon Jun 5 22:19:15 2017 +0300
Committer: Jeremy Mitchell <[email protected]>
Committed: Tue Jul 18 12:12:32 2017 -0600

----------------------------------------------------------------------
 traffic_ops/app/lib/API/User.pm | 3 ++-
 traffic_ops/app/lib/UI/Utils.pm | 5 -----
 2 files changed, 2 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/90612170/traffic_ops/app/lib/API/User.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/API/User.pm b/traffic_ops/app/lib/API/User.pm
index 91b56fd..3f03ad2 100644
--- a/traffic_ops/app/lib/API/User.pm
+++ b/traffic_ops/app/lib/API/User.pm
@@ -250,7 +250,8 @@ sub create {
        }
 
        #setting tenant_id to the user's tenant if tenant is not set. 
TODO(nirs): remove when tenancy is no longer optional in the API
-       my $tenant_id = exists( $params->{tenantId} ) ? $params->{tenantId} : 
$self->current_user_tenant();
+       my $tenantUtils = UI::TenantUtils->new($self);
+       my $tenant_id = exists( $params->{tenantId} ) ? $params->{tenantId} : 
$tenantUtils->current_user_tenant();
 
        my $values = {
                address_line1        => $params->{addressLine1},

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/90612170/traffic_ops/app/lib/UI/Utils.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/UI/Utils.pm b/traffic_ops/app/lib/UI/Utils.pm
index 2b22726..2dba89f 100644
--- a/traffic_ops/app/lib/UI/Utils.pm
+++ b/traffic_ops/app/lib/UI/Utils.pm
@@ -408,9 +408,4 @@ sub defined_or_default {
        return defined($val) ? $val : $default;
 }
 
-sub current_user_tenant {
-    my $self = shift;
-    return $self->db->resultset('TmUser')->search( { username => 
$self->current_user()->{username} } )->get_column('tenant_id')->single();
-}    
-
 1;

Reply via email to