Skip to content

Commit cefa093

Browse files
authored
Merge pull request #1882 from dolthub/taylor/clone-admin-global
Add dynamic privilege CLONE_ADMIN
2 parents 106040e + f5ae494 commit cefa093

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

enginetest/queries/priv_auth_queries.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,7 @@ var UserPrivTests = []UserPrivilegeTest{
596596
SetUpScript: []string{
597597
"CREATE USER testuser@localhost;",
598598
"GRANT REPLICATION_SLAVE_ADMIN ON *.* TO testuser@localhost;",
599+
"GRANT CLONE_ADMIN ON *.* TO testuser@localhost;",
599600
},
600601
Assertions: []UserPrivilegeTestAssertion{
601602
{
@@ -611,7 +612,7 @@ var UserPrivTests = []UserPrivilegeTest{
611612
Query: "SHOW GRANTS FOR testuser@localhost;",
612613
Expected: []sql.Row{
613614
{"GRANT USAGE ON *.* TO `testuser`@`localhost`"},
614-
{"GRANT REPLICATION_SLAVE_ADMIN ON *.* TO `testuser`@`localhost`"},
615+
{"GRANT CLONE_ADMIN, REPLICATION_SLAVE_ADMIN ON *.* TO `testuser`@`localhost`"},
615616
},
616617
},
617618
{

sql/plan/clone_commands.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2022 Dolthub, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package plan
16+
17+
// DynamicPrivilege_CloneAdmin is the dynamic privilege required to execute clone commands.
18+
// https://dev.mysql.com/doc/refman/8.0/en/privileges-provided.html#priv_clone-admin
19+
const DynamicPrivilege_CloneAdmin = "clone_admin"

sql/plan/grant_data.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ func (p *Privilege) String() string {
217217
func (p *Privilege) IsValidDynamic() bool {
218218
if p.Type == PrivilegeType_Dynamic {
219219
switch p.Dynamic {
220-
case DynamicPrivilege_ReplicationSlaveAdmin:
220+
case DynamicPrivilege_ReplicationSlaveAdmin, DynamicPrivilege_CloneAdmin:
221221
return true
222222
}
223223
}

0 commit comments

Comments
 (0)