[jira] [Commented] (TC-550) TO API - fetch deliveryservices for a user should have tenancy hooked in

2017-08-24 Thread Jeremy Mitchell (JIRA)

[ 
https://issues.apache.org/jira/browse/TC-550?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16140350#comment-16140350
 ] 

Jeremy Mitchell commented on TC-550:


the intent of api/version/users/:id/deliveryservices is to show the 
deliveryservices that a user can interact with. this used to be simply reading 
the ds/user table but now with tenancy that has changed.

with use-tenancy=0, that means show the contents of deliveryservice_tmuser for 
that user
with use-tenancy=1, that means show all the ds’s associated with the tenants in 
the users tenant tree

> TO API - fetch deliveryservices for a user should have tenancy hooked in
> 
>
> Key: TC-550
> URL: https://issues.apache.org/jira/browse/TC-550
> Project: Traffic Control
>  Issue Type: Bug
>  Components: Traffic Ops API
>Affects Versions: 2.1.0
>Reporter: Jeremy Mitchell
>
> The following api route does not take into consideration the tenancy of the 
> specified user:
> get( "/api/$version/users/:id/deliveryservices
> it currently does the following:
> 1. it checks the tenancy of the specified user vs. the tenancy of the current 
> user to ensure the current user can see the specified user <-- this is good
> 2. it queries the deliveryservice_tmuser table to find the delivery services 
> associated to the tm_user and then if finally filters the results based on 
> the current user's tenancy <-- it should not query this table if use_tenancy 
> = 1
> if use_tenancy = 0, it should work the way it does now
> if use_tenancy = 1, it should not query the deliveryservice_tmuser table but 
> instead query the deliveryservice table and filter the results against the 
> specified user's tenant AND the current user's tenant.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (TC-550) TO API - fetch deliveryservices for a user should have tenancy hooked in

2017-08-23 Thread Nir Sopher (JIRA)

[ 
https://issues.apache.org/jira/browse/TC-550?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16139010#comment-16139010
 ] 

Nir Sopher commented on TC-550:
---

What is the purpose of this endpoint?
When writing the code I considered it as a "read" endpoint to the DS/User 
table, not as "give me the list of DSes another user can see".
Nir

> TO API - fetch deliveryservices for a user should have tenancy hooked in
> 
>
> Key: TC-550
> URL: https://issues.apache.org/jira/browse/TC-550
> Project: Traffic Control
>  Issue Type: Bug
>  Components: Traffic Ops API
>Affects Versions: 2.1.0
>Reporter: Jeremy Mitchell
>
> The following api route does not take into consideration the tenancy of the 
> specified user:
> get( "/api/$version/users/:id/deliveryservices
> it currently does the following:
> 1. it checks the tenancy of the specified user vs. the tenancy of the current 
> user to ensure the current user can see the specified user <-- this is good
> 2. it queries the deliveryservice_tmuser table to find the delivery services 
> associated to the tm_user and then if finally filters the results based on 
> the current user's tenancy <-- it should not query this table if use_tenancy 
> = 1
> if use_tenancy = 0, it should work the way it does now
> if use_tenancy = 1, it should not query the deliveryservice_tmuser table but 
> instead query the deliveryservice table and filter the results against the 
> specified user's tenant AND the current user's tenant.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (TC-550) TO API - fetch deliveryservices for a user should have tenancy hooked in

2017-08-23 Thread Jeremy Mitchell (JIRA)

[ 
https://issues.apache.org/jira/browse/TC-550?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16138965#comment-16138965
 ] 

Jeremy Mitchell commented on TC-550:


On this line:

https://github.com/apache/incubator-trafficcontrol/blob/master/traffic_ops/app/lib/API/Deliveryservice.pm#L982

maybe it should be something like:

if (!$tenant_utils->is_ds_resource_accessible($tenants_data, $row->tenant_id) 
&& !$tenant_utils->is_ds_resource_accessible($tenants_data, $row->tenant_id, 
user.tenant_id) ) {
 next;
}

I passed in a 3rd optional argument to is_ds_resource_accessible() and 
specified the tenant i wanted to have the $row.tenant_id checked against

so in this case, i want tenancy to be checked against the current_user.tenant 
AND the user.tenant..

> TO API - fetch deliveryservices for a user should have tenancy hooked in
> 
>
> Key: TC-550
> URL: https://issues.apache.org/jira/browse/TC-550
> Project: Traffic Control
>  Issue Type: Bug
>  Components: Traffic Ops API
>Affects Versions: 2.1.0
>Reporter: Jeremy Mitchell
>
> The following api route does not take into consideration the tenancy of the 
> specified user:
> get( "/api/$version/users/:id/deliveryservices
> it currently does the following:
> 1. it checks the tenancy of the specified user vs. the tenancy of the current 
> user to ensure the current user can see the specified user <-- this is good
> 2. it queries the deliveryservice_tmuser table to find the delivery services 
> associated to the tm_user and then if finally filters the results based on 
> the current user's tenancy <-- it should not query this table if use_tenancy 
> = 1
> if use_tenancy = 0, it should work the way it does now
> if use_tenancy = 1, it should not query the deliveryservice_tmuser table but 
> instead query the deliveryservice table and filter the results against the 
> specified user's tenant AND the current user's tenant.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)