This is an automated email from the ASF dual-hosted git repository.

dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git

commit a8db924192f7515969a986be2375a3e0c6031a70
Author: zfr95 <[email protected]>
AuthorDate: Thu Jul 4 10:55:05 2024 +0800

    [Fix](auth)add user cluster USAGE_PRIV in cloud mode (#37206)
---
 .../suites/auth_p0/test_master_slave_consistency_auth.groovy     | 8 ++++++++
 regression-test/suites/auth_p0/test_select_column_auth.groovy    | 9 +++++++++
 regression-test/suites/auth_up_down_p0/load.groovy               | 8 ++++++++
 3 files changed, 25 insertions(+)

diff --git 
a/regression-test/suites/auth_p0/test_master_slave_consistency_auth.groovy 
b/regression-test/suites/auth_p0/test_master_slave_consistency_auth.groovy
index 9e5239f6434..6c8f7e520b8 100644
--- a/regression-test/suites/auth_p0/test_master_slave_consistency_auth.groovy
+++ b/regression-test/suites/auth_p0/test_master_slave_consistency_auth.groovy
@@ -101,6 +101,14 @@ suite ("test_follower_consistent_auth","p0,auth") {
         sql """refresh MATERIALIZED VIEW ${dbName}.${mtmv_name} auto"""
         sql """grant select_priv on regression_test to ${user}"""
 
+        //cloud-mode
+        if (isCloudMode()) {
+            def clusters = sql " SHOW CLUSTERS; "
+            assertTrue(!clusters.isEmpty())
+            def validCluster = clusters[0][0]
+            sql """GRANT USAGE_PRIV ON CLUSTER ${validCluster} TO ${user}""";
+        }
+
 
         connect(user=user, password="${pwd}", url=context.config.jdbcUrl) {
             try {
diff --git a/regression-test/suites/auth_p0/test_select_column_auth.groovy 
b/regression-test/suites/auth_p0/test_select_column_auth.groovy
index 7e6cca7ce2d..2484eae5527 100644
--- a/regression-test/suites/auth_p0/test_select_column_auth.groovy
+++ b/regression-test/suites/auth_p0/test_select_column_auth.groovy
@@ -25,12 +25,21 @@ suite("test_select_column_auth","p0,auth") {
     String view_name = 'test_select_column_auth_view'
     String rollup_name = 'test_select_column_auth_rollup'
     String catalog_name = 'test_select_column_auth_catalog'
+
     try_sql("drop user ${user}")
     try_sql """drop table if exists ${dbName}.${tableName}"""
     sql """drop database if exists ${dbName}"""
 
     sql """create user '${user}' IDENTIFIED by '${pwd}'"""
 
+    //cloud-mode
+    if (isCloudMode()) {
+        def clusters = sql " SHOW CLUSTERS; "
+        assertTrue(!clusters.isEmpty())
+        def validCluster = clusters[0][0]
+        sql """GRANT USAGE_PRIV ON CLUSTER ${validCluster} TO ${user}""";
+    }
+
     sql """create database ${dbName}"""
     sql """
         CREATE TABLE IF NOT EXISTS ${dbName}.`${tableName}` (
diff --git a/regression-test/suites/auth_up_down_p0/load.groovy 
b/regression-test/suites/auth_up_down_p0/load.groovy
index fd1405e58e9..9a0d2b38d36 100644
--- a/regression-test/suites/auth_up_down_p0/load.groovy
+++ b/regression-test/suites/auth_up_down_p0/load.groovy
@@ -45,6 +45,14 @@ suite("test_upgrade_downgrade_prepare_auth","p0,auth") {
     sql """CREATE ROLE ${role1}"""
     sql """CREATE ROLE ${role2}"""
 
+    //cloud-mode
+    if (isCloudMode()) {
+        def clusters = sql " SHOW CLUSTERS; "
+        assertTrue(!clusters.isEmpty())
+        def validCluster = clusters[0][0]
+        sql """GRANT USAGE_PRIV ON CLUSTER ${validCluster} TO ${user1}""";
+        sql """GRANT USAGE_PRIV ON CLUSTER ${validCluster} TO ${user2}""";
+    }
 
     try_sql """drop table if exists ${dbName}.${tableName1}"""
     sql """drop database if exists ${dbName}"""


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to