You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2022/07/18 18:28:19 UTC

[GitHub] [trafficcontrol] ocket8888 commented on a diff in pull request #6767: Unit test for t3c login cookie

ocket8888 commented on code in PR #6767:
URL: https://github.com/apache/trafficcontrol/pull/6767#discussion_r923688892


##########
cache-config/testing/ort-tests/tcdata/todb.go:
##########
@@ -148,6 +148,8 @@ func SetupRoleCapabilities(db *sql.DB) error {
 	sqlStmt := `
 INSERT INTO role_capability (role_id, cap_name) VALUES (4,'all-write') ON CONFLICT DO NOTHING;
 INSERT INTO role_capability (role_id, cap_name) VALUES (4,'all-read') ON CONFLICT DO NOTHING;
+INSERT INTO role_capability (role_id, cap_name) VALUES (3,'all-read') ON CONFLICT DO NOTHING;
+INSERT INTO role_capability (role_id, cap_name) VALUES (3,'all-write') ON CONFLICT DO NOTHING;

Review Comment:
   These don't actually do anything unless you set them to explicitly in your Traffic Ops configuration file (and it isn't in these tests). In which case, these specific strings (`all-read` and `all-write`) still have no effect and no meaning.



##########
cache-config/testing/ort-tests/tcdata/todb.go:
##########
@@ -101,7 +101,7 @@ func SetupRoles(db *sql.DB) error {
 	sqlStmt := `
 INSERT INTO role (name, description, priv_level) VALUES ('disallowed','Block all access',0) ON CONFLICT DO NOTHING;
 INSERT INTO role (name, description, priv_level) VALUES ('read-only','Block all access', 10) ON CONFLICT DO NOTHING;
-INSERT INTO role (name, description, priv_level) VALUES ('operations','Block all access', 20) ON CONFLICT DO NOTHING;
+INSERT INTO role (name, description, priv_level) VALUES ('operations','Operations-user', 30) ON CONFLICT DO NOTHING;

Review Comment:
   The "operations" Role as created by `seeds.sql` on new ATC/TO installs has privilege level 20. If you need admin-level Permissions, why not just use the admin Role instead of confusing this concept?



##########
cache-config/testing/ort-tests/tcdata/todb.go:
##########
@@ -169,7 +171,7 @@ func (r *TCData) SetupTmusers(db *sql.DB) error {
 	sqlStmt := `
 INSERT INTO tm_user (username, local_passwd, role, tenant_id) VALUES ('` + r.Config.TrafficOps.Users.Disallowed + `','` + encryptedPassword + `', 1, 1);
 INSERT INTO tm_user (username, local_passwd, role, tenant_id) VALUES ('` + r.Config.TrafficOps.Users.ReadOnly + `','` + encryptedPassword + `', 2, 1);
-INSERT INTO tm_user (username, local_passwd, role, tenant_id) VALUES ('` + r.Config.TrafficOps.Users.Operations + `','` + encryptedPassword + `', 3, 1);
+INSERT INTO tm_user (username, local_passwd, role, tenant_id) VALUES ('` + r.Config.TrafficOps.Users.Operations + `','` + encryptedPassword + `', 4, 1);

Review Comment:
   You changed the "operations" Role above, but this changes the "operations" user to have the "admin" Role instead of the "operations" Role at all, so those changes are totally unused.



-- 
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: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org