Github user nir-sopher commented on a diff in the pull request: https://github.com/apache/incubator-trafficcontrol/pull/644#discussion_r124640284 --- Diff: traffic_ops/app/lib/API/Tenant.pm --- @@ -248,7 +326,17 @@ sub delete { if ( !defined($tenant) ) { return $self->not_found(); } - my $name = $self->db->resultset('Tenant')->search( { id => $id } )->get_column('name')->single(); + + my $parent_tenant = $tenant->parent_id; + + my $tenant_utils = UI::TenantUtils->new($self); + my $tenants_data = $tenant_utils->create_tenants_data_from_db(undef); + + if (!$tenant_utils->is_tenant_resource_accessible($tenants_data, $parent_tenant)) { --- End diff -- I see the parent as an owner of the child, and as such he is the one to be able to delete it. It is a matter of taste, but note: anyhow a user must not delete his own tenant...
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---