Repository: incubator-trafficcontrol Updated Branches: refs/heads/master cefba0d1d -> 9f41574a4
User default tenancy - undef Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/95471c62 Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/95471c62 Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/95471c62 Branch: refs/heads/master Commit: 95471c62d0417a0e854c170c7bd9d6d822b2b6da Parents: cefba0d Author: nir-sopher <n...@qwilt.com> Authored: Sat Jul 22 06:13:21 2017 +0300 Committer: Jeremy Mitchell <mitchell...@gmail.com> Committed: Thu Jul 27 10:30:02 2017 -0600 ---------------------------------------------------------------------- traffic_ops/app/lib/API/User.pm | 2 +- traffic_ops/app/lib/UI/User.pm | 2 +- traffic_ops/app/t/api/1.2/user_admin.t | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/95471c62/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 85dac74..eaa9a20 100644 --- a/traffic_ops/app/lib/API/User.pm +++ b/traffic_ops/app/lib/API/User.pm @@ -261,7 +261,7 @@ 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_utils = Utils::Tenant->new($self); - my $tenant_id = exists( $params->{tenantId} ) ? $params->{tenantId} : $tenant_utils->current_user_tenant(); + my $tenant_id = $params->{tenantId}; my $tenants_data = $tenant_utils->create_tenants_data_from_db(); if (!$tenant_utils->is_user_resource_accessible($tenants_data, $tenant_id)) { return $self->alert("Invalid tenant. This tenant is not available to you for assignment."); http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/95471c62/traffic_ops/app/lib/UI/User.pm ---------------------------------------------------------------------- diff --git a/traffic_ops/app/lib/UI/User.pm b/traffic_ops/app/lib/UI/User.pm index a8d5487..d3b30c3 100644 --- a/traffic_ops/app/lib/UI/User.pm +++ b/traffic_ops/app/lib/UI/User.pm @@ -291,7 +291,7 @@ sub create_user { { full_name => $self->param('tm_user.full_name'), username => $self->param('tm_user.username'), - tenant_id => $tenantUtils->current_user_tenant(), #Tenancy is not dealt by the UI for now. getting the tenancy from the user + tenant_id => undef, #Tenancy is not dealt by the UI for now. settin to no tenant - minimal priviledge to the user public_ssh_key => $self->param('tm_user.public_ssh_key'), phone_number => $self->param('tm_user.phone_number'), email => $self->param('tm_user.email'), http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/95471c62/traffic_ops/app/t/api/1.2/user_admin.t ---------------------------------------------------------------------- diff --git a/traffic_ops/app/t/api/1.2/user_admin.t b/traffic_ops/app/t/api/1.2/user_admin.t index ec7b82b..b25920b 100644 --- a/traffic_ops/app/t/api/1.2/user_admin.t +++ b/traffic_ops/app/t/api/1.2/user_admin.t @@ -62,7 +62,7 @@ sub run_ut { ->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/username" => $addedUserName ) ->json_is( "/response/email" => $addedUserEmail) - ->json_is( "/response/tenantId" => $tenant_id) #tenant Id not set - getting the tenant id from the user + ->json_is( "/response/tenantId" => undef) #tenant Id not set - getting the undef user , 'Success added user?'; #same name again - fail