zhangjidi2016 commented on a change in pull request #6:
URL: https://github.com/apache/rocketmq-dashboard/pull/6#discussion_r691962620
##########
File path: doc/1_0_0/UserGuide_CN.md
##########
@@ -112,4 +112,35 @@ admin=admin,1
user1=user1
user2=user2
```
-* 3. 启动控制台则开启了登录功能
\ No newline at end of file
+* 3.启动控制台则开启了登录功能
+
+## 权限检验
+如果用户访问console时开启了登录功能,会按照登录的角色对访问的接口进行权限控制。
+* 1.在Spring配置文件resources/application.properties中修改 开启登录功能
+```$xslt
+ # 开启登录功能
+ rocketmq.config.loginRequired=true
+
+ # Dashboard文件目录,登录用户配置文件所在目录
+ rocketmq.config.dataPath=/tmp/rocketmq-console/data
+```
+* 2.确保${rocketmq.config.dataPath}定义的目录存在,并且该目录下创建登录配置文件"role-permission.yml",
+如果该目录下不存在此文件,则默认使用resources/role-permission.yml文件。改文件保存了普通用户角色所有能访问的接口地址。
+role-permission.yml文件格式为:
+```$xslt
+# 该文件支持热修改,即添加和修改用户时,不需要重新启动console
+# 格式,如果增加和删除接口权限,直接在列表中增加和删除接口地址即可。
+
+# 普通用户
+rolePerms:
+ ordinary:
+ - /rocketmq/nsaddr
+ - /ops/homepage.query
+ - /cluster/list.query
+ - /cluster/brokerConfig.query
+ - /dashboard/broker.query
+ - /dashboard/topic.query
+ - /dashboard/topicCurrent
+ ....
Review comment:
Ok, the interface path in the authentication file is added with wildcard
characters
##########
File path:
src/main/java/org/apache/rocketmq/dashboard/permisssion/Permission.java
##########
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+package org.apache.rocketmq.dashboard.permisssion;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.TYPE, ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Permission {
+
+ String value() default "";
Review comment:
This value attribute is not used, then delete
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]