zhangjidi2016 commented on a change in pull request #71: URL: https://github.com/apache/rocketmq-dashboard/pull/71#discussion_r805545181
########## File path: src/main/java/org/apache/rocketmq/dashboard/controller/AclController.java ########## @@ -0,0 +1,133 @@ +/* + * 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.controller; + +import com.google.common.base.Preconditions; +import java.util.List; +import org.apache.rocketmq.common.AclConfig; +import org.apache.rocketmq.common.PlainAccessConfig; +import org.apache.rocketmq.dashboard.config.RMQConfigure; +import org.apache.rocketmq.dashboard.model.request.AclRequest; +import org.apache.rocketmq.dashboard.service.AclService; +import org.apache.rocketmq.dashboard.support.JsonResult; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/acl") +public class AclController { Review comment: Add permission control for ACL-related operation interfaces for different login role ########## File path: src/main/resources/static/view/pages/acl.html ########## @@ -0,0 +1,468 @@ +<!-- + ~ 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. + --> +<div class="container-fluid" id="deployHistoryList"> + <div class="modal-body"> + <div ng-cloak="" class="tabsdemoDynamicHeight"> + <md-content> + <md-tabs md-dynamic-height="" md-border-bottom=""> + <md-tab label="Account Info"> + <md-content class="md-padding" style="min-height:600px"> + <form class="form-inline pull-left col-sm-12"> + <div class="form-group"> + <label>Access Key:</label> + <input class="form-control" style="width: 450px" type="text" ng-model="filterStr"/> + </div> + + <button class="btn btn-raised btn-sm btn-primary" type="button" + ng-click="openAddDialog()">{{'ADD' | + translate}} + </button> + </form> + <table class="table table-bordered"> + <tr> + <th class="text-center">Access Key</th> + <th class="text-center">Secret Key</th> + <th class="text-center">{{'IS_ADMIN' | translate}}</th> + <th class="text-center">{{'DEFAULT_TOPIC_PERM' | translate}}</th> + <th class="text-center">{{'DEFAULT_GROUP_PERM' | translate}}</th> + <th class="text-center">{{'TOPIC_PERM' | translate}}</th> + <th class="text-center">{{'GROUP_PERM' | translate}}</th> + <th class="text-center">{{'OPERATION' | translate}}</th> + </tr> + <tr ng-repeat="item in plainAccessConfigs"> + <td class="text-center">{{item.accessKey}}</td> + <td class="text-center">{{item.secretKey}}</td> + <td class="text-center">{{item.admin}}</td> + <td class="text-center">{{item.defaultTopicPerm}}</td> + <td class="text-center">{{item.defaultGroupPerm}}</td> + <td class="text-center"> + <table ng-repeat="topic in item.topicPerms" class="perm-table"> + <tr> + <td class="perm-tg">{{topic}}</td> + <td class="center"><a href="javascript:;" + ng-click="openUpdateTopicDialog(item, topic)"> + {{'UPDATE' | translate}}</a></td> + <td><a href="javascript:;" + ng-confirm-click="Are you sure to delete {{topic}}?" + confirmed-click="deletePermConfig(item, topic, 'topic')">{{'DELETE' | translate}}</a> + </td> + </tr> + </table> + </td> + <td class="text-center"> + <table ng-repeat="group in item.groupPerms" class="perm-table"> + <tr> + <td class="perm-tg">{{group}}</td> + <td class="center"><a href="javascript:;" + ng-click="openUpdateGroupDialog(item, group)"> + {{'UPDATE' | translate}}</a></td> + <td><a href="javascript:;" + ng-confirm-click="Are you sure to delete {{group}}?" + confirmed-click="deletePermConfig(item, group, 'group')">{{'DELETE' | translate}}</a> + </td> + </tr> + </table> + </td> + <td class="text-center"> + <button class="btn btn-raised btn-sm btn-primary" type="button" + ng-click="openAddTopicDialog(item)"> + {{'ADD' | translate}}topic + </button> + <button class="btn btn-raised btn-sm btn-primary" type="button" + ng-click="openAddGroupDialog(item)"> + {{'ADD' | translate}}group + </button> + <button class="btn btn-raised btn-sm btn-primary" type="button" + ng-click="openUpdateDialog(item)"> + {{'UPDATE' | translate}} + </button> + <button class="btn btn-raised btn-sm btn-danger" type="button" + ng-confirm-click="Are you sure to delete {{item.accessKey}}?" + confirmed-click="deleteAclConfig(item.accessKey)">{{'DELETE' | translate}} + </button> + <button class="btn btn-raised btn-sm btn-danger" type="button" + ng-click="synchronizeData(item)">{{'SYNCHRONIZE' | translate}} Review comment: Hide action buttons based on login roles -- 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]
