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/04/26 16:30:49 UTC

[GitHub] [trafficcontrol] srijeet0406 commented on a diff in pull request #6761: Add "sharing" ability to CDN locks

srijeet0406 commented on code in PR #6761:
URL: https://github.com/apache/trafficcontrol/pull/6761#discussion_r858926741


##########
traffic_ops/traffic_ops_golang/cdn_lock/cdn_lock.go:
##########
@@ -32,12 +32,32 @@ import (
 	"github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api"
 	"github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/auth"
 	"github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/dbhelpers"
+
+	"github.com/lib/pq"
 )
 
-const readQuery = `SELECT username, cdn, message, soft, last_updated FROM cdn_lock`
-const insertQuery = `INSERT INTO cdn_lock (username, cdn, message, soft) VALUES (:username, :cdn, :message, :soft) RETURNING username, cdn, message, soft, last_updated`
-const deleteQuery = `DELETE FROM cdn_lock WHERE cdn=$1 AND username=$2 RETURNING username, cdn, message, soft, last_updated`
-const deleteAdminQuery = `DELETE FROM cdn_lock WHERE cdn=$1 RETURNING username, cdn, message, soft, last_updated`
+const readQuery = `SELECT username, cdn, message, soft, shared_usernames, last_updated FROM cdn_lock`
+const insertQuery = `INSERT INTO cdn_lock (username, cdn, message, soft, shared_usernames) VALUES ($1, $2, $3, $4, $5) RETURNING username, cdn, message, soft, shared_usernames, last_updated`
+const deleteQuery = `DELETE FROM cdn_lock WHERE cdn=$1 AND username=$2 RETURNING username, cdn, message, soft, shared_usernames, last_updated`
+const deleteAdminQuery = `DELETE FROM cdn_lock WHERE cdn=$1 RETURNING username, cdn, message, soft, shared_usernames, last_updated`
+const checkSharedUsersValidityQuery = `select count(*) from tm_user u join role r on r.id = u.role join role_capability rc on rc.role_id = r.id where u.tenant_id in (WITH RECURSIVE
+user_tenant_id as (select (select tenant_id from tm_user where username=$1)::bigint as v),

Review Comment:
   you're right, we shouldn't have to check tenancy as long as we check the perms.



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