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 (#7888)
  • Loading branch information
zrhoffman committed Dec 20, 2023
1 parent 83556e8 commit 26ef01b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 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 @@ -91,9 +91,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 @@ -93,9 +93,8 @@ func TestServersIDDeliveryServices(t *testing.T) {
[]int{
totest.GetDeliveryServiceId(t, TOSession, "ds-top")(),
totest.GetDeliveryServiceId(t, TOSession, "ds-top-req-cap2")(),
totest.GetDeliveryServiceId(t, TOSession, "ds-forked-topology")(),
},
3)),
2)),
},
"CONFLICT when SERVER NOT IN SAME CDN as DELIVERY SERVICE": {
EndpointID: totest.GetServerID(t, TOSession, "cdn2-test-edge"),
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 (
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)))
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 26ef01b

Please sign in to comment.