Skip to content

Commit

Permalink
Minor tweaks
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <mattalord@gmail.com>
  • Loading branch information
mattlord committed Sep 12, 2024
1 parent fee35f2 commit 5d6dc26
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions go/vt/vttablet/tabletmanager/rpc_vreplication.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,22 @@ const (
// Check if workflow is still copying.
sqlGetVReplicationCopyStatus = "select distinct vrepl_id from %s.copy_state where vrepl_id = %d"
// Validate the minimum set of permissions needed to manage vreplication metadata.
// This is a simple check for a matching user rather than any specific user@host
// combination.
sqlValidateVReplicationPermissions = `
select if(count(*)>0, 1, 0) as good from mysql.user as u
left join mysql.db as d on (u.user = d.user)
left join mysql.tables_priv as t on (u.user = t.user)
where u.user = %a
and (
(u.insert_priv = 'y' and u.update_priv = 'y' and u.delete_priv = 'y')
or (d.db = %a and u.insert_priv = 'y' and u.update_priv = 'y' and u.delete_priv = 'y')
or (t.db = %a and t.table_name = 'vreplication'
(u.insert_priv = 'y' and u.update_priv = 'y' and u.delete_priv = 'y') /* user has global privs */
or (d.db = %a and u.insert_priv = 'y' and u.update_priv = 'y' and u.delete_priv = 'y') /* user has db privs */
or (t.db = %a and t.table_name = 'vreplication' /* user has table privs */
and find_in_set('insert', t.table_priv)
and find_in_set('update', t.table_priv)
and find_in_set('delete', t.table_priv)
)
)
) limit 1
`
)

Expand Down

0 comments on commit 5d6dc26

Please sign in to comment.