zrhoffman commented on code in PR #7309: URL: https://github.com/apache/trafficcontrol/pull/7309#discussion_r1089308720
########## traffic_ops/app/db/migrations/2023012316280200_create_new_role.down.sql: ########## @@ -0,0 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +DELETE FROM public.role_capability rc WHERE rc.role_id='trouter'; + +DELETE FROM public."role" r WHERE r.name='trouter'; Review Comment: In order to be POSIX-compliant, every file should end with a newline.  ########## traffic_ops/app/db/migrations/2023012316280200_create_new_role.up.sql: ########## @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +INSERT INTO public."role" (name, description, priv_level) +VALUES('trouter', 'Limited role for Traffic Router calls to Traffic Ops', 10); + +INSERT INTO public.role_capability (role_id, cap_name) + VALUES ( + (SELECT id FROM role WHERE name='trouter'), + UNNEST(ARRAY[ + 'CDN:READ', + 'DELIVERY-SERVICE:READ', + 'DNS-SEC:READ', + 'FEDERATION:READ', + 'STEERING:READ', + 'FEDERATION-RESOLVER:READ', + 'DS-SECURITY-KEY:READ'] + ) + ); Review Comment: Another file needing to end with a newline ########## CHANGELOG.md: ########## @@ -25,6 +25,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - [#7113](https://github.com/apache/trafficcontrol/pull/7113) *Traffic Portal* Minimize the Server Server Capability part of the *Traffic Servers* section of the Snapshot Diff - [#7273](https://github.com/apache/trafficcontrol/pull/7273) *Traffic Ops* Adds SSL-KEY-EXPIRATION:READ permission to operations, portal, read-only, federation and steering roles - [#7296](https://github.com/apache/trafficcontrol/pull/7296) *Traffic Portal* New configuration option in `traffic_portal_properties.json` at `deliveryServices.exposeInactive` controls exposing APIv5 DS Active State options in the TP UI. +- [#7309](https://github.com/apache/trafficcontrol/pull/7309) *Traffic Ops* Creates new role `trouter` with CDN:READ, DELIVERY-SERVICE:READ, DNS-SEC:READ, FEDERATION:READ, STEERING:READ, FEDERATION-RESOLVER:READ, DS-SECURITY-KEY:READ Review Comment: No need to list the precise permissions, just mentioning it's the ones TR needs to watch TO resources should be enough ########## traffic_ops/app/db/migrations/2023012316280200_create_new_role.down.sql: ########## @@ -0,0 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +DELETE FROM public.role_capability rc WHERE rc.role_id='trouter'; Review Comment: >> No need to delete from `role_capability` here, since `role_id` is a foreign key an `DELETE` cascasdes >> >> https://github.com/apache/trafficcontrol/blob/396d474320f0628b72bb407efc795ac4cacde6cd/traffic_ops/app/db/create_tables.sql#L3772-L3773 > > Removed line to delete on `role_capability`. Assuming what you are say, that when it deletes `role` it will remove it from `role_capability` as well. `DELETE FROM public.role_capability` came back and should be removed again 🙂 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
