Github user mitchell852 commented on a diff in the pull request:
https://github.com/apache/incubator-trafficcontrol/pull/433#discussion_r112023530
--- Diff: traffic_ops/app/lib/API/Tenant.pm ---
@@ -44,14 +44,16 @@ sub index {
my $orderby = $self->param('orderby') || "name";
my $rs_data = $self->db->resultset("Tenant")->search( undef, {order_by
=> 'me.' . $orderby } );
while ( my $row = $rs_data->next ) {
- push(
- @data, {
- "id" => $row->id,
- "name" => $row->name,
- "active" => \$row->active,
- "parentId" => $row->parent_id,
- }
- );
+ if (verify_tenancy_for_read($self, $row->id)) {
--- End diff --
this might cause problems. for example, if there are 200 tenants, i think
this will run 400 queries. since it looks like verify_tenancy() makes 2 queries
for each time it is called. i would recommend making your initial query smarter.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---