This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 4f65a9c4258 [fix](auth)fix not display be_port (#25197)
4f65a9c4258 is described below
commit 4f65a9c425815640e924c8459dcd6d9b67e5b42a
Author: zhangdong <[email protected]>
AuthorDate: Fri Oct 13 11:56:00 2023 +0800
[fix](auth)fix not display be_port (#25197)
fix not display be_port who has ADMIN_PRIV
---
.../apache/doris/common/proc/BackendsProcDir.java | 2 --
.../java/org/apache/doris/qe/ShowExecutor.java | 13 -------
.../nereids_p0/system/test_query_sys_tables.groovy | 2 +-
.../suites/show_p0/test_show_backends.groovy | 42 ++++++++++++++++++++++
4 files changed, 43 insertions(+), 16 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/common/proc/BackendsProcDir.java
b/fe/fe-core/src/main/java/org/apache/doris/common/proc/BackendsProcDir.java
index b9d4db8cb91..25d6e312cbd 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/common/proc/BackendsProcDir.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/common/proc/BackendsProcDir.java
@@ -58,8 +58,6 @@ public class BackendsProcDir implements ProcDirInterface {
.add("TotalCapacity").add("UsedCapacity").add("AvailableCapacity").add("UsedPct")
.build();
- public static final int HOSTNAME_INDEX = 3;
-
private SystemInfoService systemInfoService;
public BackendsProcDir(SystemInfoService systemInfoService) {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java
b/fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java
index b8b55c57c16..f66d76eca8b 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java
@@ -682,19 +682,6 @@ public class ShowExecutor {
ProcNodeInterface procNode = showProcStmt.getNode();
List<List<String>> finalRows = procNode.fetchResult().getRows();
- // if this is superuser, hide ip and host info form backends info proc
- if (procNode instanceof BackendsProcDir) {
- if
(!Env.getCurrentEnv().getAccessManager().checkGlobalPriv(ConnectContext.get(),
PrivPredicate.OPERATOR)) {
- // hide host info
- for (List<String> row : finalRows) {
- row.remove(BackendsProcDir.HOSTNAME_INDEX);
- }
-
- // mod meta data
- metaData.removeColumn(BackendsProcDir.HOSTNAME_INDEX);
- }
- }
-
resultSet = new ShowResultSet(metaData, finalRows);
}
diff --git
a/regression-test/suites/nereids_p0/system/test_query_sys_tables.groovy
b/regression-test/suites/nereids_p0/system/test_query_sys_tables.groovy
index 7b96e1dc32f..d48b5235b91 100644
--- a/regression-test/suites/nereids_p0/system/test_query_sys_tables.groovy
+++ b/regression-test/suites/nereids_p0/system/test_query_sys_tables.groovy
@@ -180,7 +180,7 @@ suite("test_query_sys_tables", "query,p0") {
sql("GRANT SELECT_PRIV ON *.*.* TO 'test_sys_tables'")
sql("use information_schema")
qt_user_privileges """
- select GRANTEE, PRIVILEGE_TYPE, IS_GRANTABLE from user_privileges
where GRANTEE regexp '^\\'test'
+ select GRANTEE, PRIVILEGE_TYPE, IS_GRANTABLE from user_privileges
where GRANTEE regexp '^\\'test_sys_tables'
"""
sql("DROP USER 'test_sys_tables'")
diff --git a/regression-test/suites/show_p0/test_show_backends.groovy
b/regression-test/suites/show_p0/test_show_backends.groovy
new file mode 100644
index 00000000000..0ac438345e2
--- /dev/null
+++ b/regression-test/suites/show_p0/test_show_backends.groovy
@@ -0,0 +1,42 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite("test_show_backends", "show") {
+
+ sql """drop user if exists test_show_backends_user1"""
+
+ sql """create user test_show_backends_user1 identified by '12345'"""
+
+ sql """grant ADMIN_PRIV on *.*.* to test_show_backends_user1"""
+
+ result1 = connect(user = 'test_show_backends_user1', password = '12345',
url = context.config.jdbcUrl) {
+ sql """ show backends """
+ }
+ println result1.toString()
+ result2 = connect(user = 'test_show_backends_user1', password = '12345',
url = context.config.jdbcUrl) {
+ sql """ show proc '/backends' """
+ }
+ println result2.toString()
+ assertEquals(result1[0][0],result2[0][0])
+ assertEquals(result1[0][1],result2[0][1])
+ assertEquals(result1[0][2],result2[0][2])
+ assertEquals(result1[0][3],result2[0][3])
+ assertEquals(result1[0][4],result2[0][4])
+ assertEquals(result1[0][5],result2[0][5])
+ assertEquals(result1[0][6],result2[0][6])
+}
+
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]