Skip to content

Commit

Permalink
Limit Delivery Services returned for GET /servers/{id}/deliveryservic…
Browse files Browse the repository at this point in the history
…es to ones in the same CDN
  • Loading branch information
zrhoffman committed Dec 19, 2023
1 parent 36e3ae1 commit a7fa42b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

### Fixed
- [#7846](https://github.com/apache/trafficcontrol/pull/7846) *Traffic Portal* Increase State character limit
- [#7887](https://github.com/apache/trafficcontrol/pull/7887) *Traffic Ops* Limit Delivery Services returned for GET /servers/{id}/deliveryservices to ones in the same CDN

## [8.0.0] - 2023-09-20
### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,8 @@ func TestServersIDDeliveryServices(t *testing.T) {
[]int{
GetDeliveryServiceId(t, "ds-top")(),
GetDeliveryServiceId(t, "ds-top-req-cap2")(),
GetDeliveryServiceId(t, "ds-forked-topology")(),
},
3)),
2)),
},
"CONFLICT when SERVER NOT IN SAME CDN as DELIVERY SERVICE": {
EndpointID: GetServerID(t, "cdn2-test-edge"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -948,14 +948,16 @@ func (dss *TODSSDeliveryService) Read(h http.Header, useIMS bool) ([]interface{}
(ds.id in (
SELECT deliveryService FROM deliveryservice_server WHERE server = :server
) OR ds.id in (
SELECT id FROM deliveryservice
WHERE topology in (
SELECT d.id FROM deliveryservice d
JOIN cdn c ON d.cdn_id = c.id
WHERE d.topology in (

Check warning on line 953 in traffic_ops/traffic_ops_golang/deliveryservice/servers/servers.go

View check run for this annotation

Codecov / codecov/patch

traffic_ops/traffic_ops_golang/deliveryservice/servers/servers.go#L951-L953

Added lines #L951 - L953 were not covered by tests
SELECT topology FROM topology_cachegroup
WHERE cachegroup = (
SELECT name FROM cachegroup
WHERE id = (
SELECT cachegroup FROM server WHERE id = :server
)))))
)))
AND d.cdn_id = (SELECT cdn_id FROM server WHERE id = :server)))

Check warning on line 960 in traffic_ops/traffic_ops_golang/deliveryservice/servers/servers.go

View check run for this annotation

Codecov / codecov/patch

traffic_ops/traffic_ops_golang/deliveryservice/servers/servers.go#L959-L960

Added lines #L959 - L960 were not covered by tests
AND
((
(SELECT (t.name = 'ORG') FROM type t JOIN server s ON s.type = t.id WHERE s.id = :server)
Expand Down

0 comments on commit a7fa42b

Please sign in to comment.