Github user mitchell852 commented on a diff in the pull request:

    
https://github.com/apache/incubator-trafficcontrol/pull/740#discussion_r129046120
  
    --- Diff: traffic_ops/app/lib/API/Deliveryservice.pm ---
    @@ -442,6 +442,124 @@ sub update {
        }
     }
     
    +sub safe_update {
    +   my $self   = shift;
    +   my $id     = $self->param('id');
    +   my $params = $self->req->json;
    +
    +
    +   my $helper = new Utils::Helper( { mojo => $self } );
    +
    +   my $ds = $self->db->resultset('Deliveryservice')->find( { id => $id } );
    +   if ( !defined($ds) ) {
    +           return $self->not_found();
    +   }
    +
    +
    +   if ( &is_portal($self) && $helper->is_delivery_service_assigned($id) ) {
    --- End diff --
    
    Here's the thing on this conditional. There is nothing lower than portal's 
priv level (2) except for disallowed and if you are disallowed you didn't get 
this far so the first part of this check will always be true (unless the 
portal's priv level is promoted). So really it boils down to "is this ds 
assigned to you" and we usually check that if you are not ops role or above...
    
    so maybe this makes more sense:
    
    if ( &is_oper($self) || $helper->is_delivery_service_assigned($id) )
    
    with the conditional the way it is, you are preventing ops/admins from 
using this api endpoint


---
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.
---

Reply via email to