You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by ro...@apache.org on 2018/06/01 16:07:01 UTC
[incubator-trafficcontrol] 01/05: fix tenant.GetUserTenantList to
work when called on root tenant
This is an automated email from the ASF dual-hosted git repository.
rob pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-trafficcontrol.git
commit 64db1b038c31a1ffd5f9c6905cf27d9952a115ab
Author: Dylan Volz <Dy...@comcast.com>
AuthorDate: Thu May 31 19:58:47 2018 -0600
fix tenant.GetUserTenantList to work when called on root tenant
---
traffic_ops/traffic_ops_golang/tenant/tenancy.go | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/traffic_ops/traffic_ops_golang/tenant/tenancy.go b/traffic_ops/traffic_ops_golang/tenant/tenancy.go
index a649e6b..b802483 100644
--- a/traffic_ops/traffic_ops_golang/tenant/tenancy.go
+++ b/traffic_ops/traffic_ops_golang/tenant/tenancy.go
@@ -98,7 +98,7 @@ func GetUserTenantList(user auth.CurrentUser, db *sqlx.DB) ([]Tenant, error) {
var tenantID int
var name string
var active bool
- var parentID int
+ var parentID *int
rows, err := db.Query(query, user.TenantID)
if err != nil {
@@ -112,7 +112,11 @@ func GetUserTenantList(user auth.CurrentUser, db *sqlx.DB) ([]Tenant, error) {
if err := rows.Scan(&tenantID, &name, &active, &parentID); err != nil {
return nil, err
}
- tenants = append(tenants, Tenant{ID: tenantID, Name: name, Active: active, ParentID: parentID})
+ if parentID != nil {
+ tenants = append(tenants, Tenant{ID: tenantID, Name: name, Active: active, ParentID: *parentID})
+ } else {
+ tenants = append(tenants, Tenant{ID: tenantID, Name: name, Active: active, ParentID: -1})
+ }
}
return tenants, nil
--
To stop receiving notification emails like this one, please contact
rob@apache.org.