payload: {"action":"created","issue":{"url":"https://api.github.com/repos/alibaba/Sentinel/issues/745","repository_url":"https://api.github.com/repos/alibaba/Sentinel","labels_url":"https://api.github.com/repos/alibaba/Sentinel/issues/745/labels{/name}","comments_url":"https://api.github.com/repos/alibaba/Sentinel/issues/745/comments","events_url":"https://api.github.com/repos/alibaba/Sentinel/issues/745/events","html_url":"https://github.com/alibaba/Sentinel/issues/745","id":442032820,"node_id":"MDU6SXNzdWU0NDIwMzI4MjA=","number":745,"title":"ACL design of dashboard","user":{"login":"jasonjoo2010","id":17573073,"node_id":"MDQ6VXNlcjE3NTczMDcz","avatar_url":"https://avatars2.githubusercontent.com/u/17573073?v=4","gravatar_id":"","url":"https://api.github.com/users/jasonjoo2010","html_url":"https://github.com/jasonjoo2010","followers_url":"https://api.github.com/users/jasonjoo2010/followers","following_url":"https://api.github.com/users/jasonjoo2010/following{/other_user}","gists_url":"https://api.github.com/users/jasonjoo2010/gists{/gist_id}","starred_url":"https://api.github.com/users/jasonjoo2010/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasonjoo2010/subscriptions","organizations_url":"https://api.github.com/users/jasonjoo2010/orgs","repos_url":"https://api.github.com/users/jasonjoo2010/repos","events_url":"https://api.github.com/users/jasonjoo2010/events{/privacy}","received_events_url":"https://api.github.com/users/jasonjoo2010/received_events","type":"User","site_admin":false},"labels":[{"id":1010934111,"node_id":"MDU6TGFiZWwxMDEwOTM0MTEx","url":"https://api.github.com/repos/alibaba/Sentinel/labels/area/dashboard","name":"area/dashboard","color":"93edba","default":false,"description":"Issue about Sentinel Dashboard"},{"id":889565426,"node_id":"MDU6TGFiZWw4ODk1NjU0MjY=","url":"https://api.github.com/repos/alibaba/Sentinel/labels/good%20first%20issue","name":"good first issue","color":"7057ff","default":true,"description":"Good for newcomers"},{"id":889565424,"node_id":"MDU6TGFiZWw4ODk1NjU0MjQ=","url":"https://api.github.com/repos/alibaba/Sentinel/labels/kind/enhancement","name":"kind/enhancement","color":"0366d6","default":false,"description":"Category issues or prs related to enhancement."}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2019-05-09T03:28:27Z","updated_at":"2019-12-02T07:48:19Z","closed_at":null,"author_association":"COLLABORATOR","body":"## Issue Description\r\nVersion 1.6.0 introduces authorization and it's an awesome feature. That helps `dashboard` to be more complete.\r\n\r\nMy discussion here is focused on the actual authorizing design.\r\n\r\n## Interface Design\r\nFirst i think here is a little fuzzy on `AuthUser. authTarget`.\r\n\r\n```java\r\n        /**\r\n         * Query whether current user has the specific privilege to the target, the target\r\n         * may be an app name or an ip address, or other destination.\r\n         * <p>\r\n         * This method will use return value to represent  whether user has the specific\r\n         * privileges to the target, but to throw a RuntimeException to represent no auth\r\n         * is also a good way.\r\n         * </p>\r\n         *\r\n         * @param target        the target to check\r\n         * @param privilegeType the privilege type to check\r\n         * @return if current user has the specific privileges to the target, return true,\r\n         * otherwise return false.\r\n         */\r\n        boolean authTarget(String target, PrivilegeType privilegeType);\r\n```\r\n\r\nIf throwing an exception is an option it's better to include in declaration like:\r\n\r\n```java\r\n boolean authTarget(String target, PrivilegeType privilegeType) throws RuntimeException;\r\n```\r\n\r\nBut i don't think it's a good idea throwing an exception because we have `a boolean value returned` already to mark it success or fail.\r\n\r\n## Integrating\r\nFor function integrating we can find following lines everywhere:\r\n\r\n```java\r\nAuthUser authUser = authService.getAuthUser(request);\r\nauthUser.authTarget(app, PrivilegeType.READ_RULE);\r\n```\r\n\r\nIt includes two intents:\r\n1. Get the current logged user information\r\n2. Check if he has the specific privilege.\r\n\r\nBut it's a little inconvenient. I have a proposal on it like:\r\n\r\n```java\r\n@AuthAction(privilege = PrivilegeType.READ_RULE)\r\n@GetMapping(\"example\")\r\npublic String action() {\r\n}\r\n```\r\nor\r\n\r\n```java\r\n@AuthAction(app = app, privilege = PrivilegeType.READ_RULE)\r\n@GetMapping(\"example\")\r\npublic String action() {\r\n}\r\n```\r\nor even a parent privilege like\r\n\r\n```java\r\n@AuthAction(privilege = PrivilegeType.RULES)\r\n@RequestMapping(\"/rules\")\r\n@Controller\r\npublic class RulesController() {\r\n}\r\n```\r\n\r\nWhen you want user information we can inject it by `Spring Argument Resolver` like:\r\n\r\n```java\r\n@AuthAction(app = app, privilege = PrivilegeType.READ_RULE)\r\n@GetMapping(\"example\")\r\npublic String action(AuthUser authUser) {\r\n}\r\n```\r\n\r\nI think we can make more discussions."},"comment":{"url":"https://api.github.com/repos/alibaba/Sentinel/issues/comments/560274880","html_url":"https://github.com/alibaba/Sentinel/issues/745#issuecomment-560274880","issue_url":"https://api.github.com/repos/alibaba/Sentinel/issues/745","id":560274880,"node_id":"MDEyOklzc3VlQ29tbWVudDU2MDI3NDg4MA==","user":{"login":"sczyh30","id":9434884,"node_id":"MDQ6VXNlcjk0MzQ4ODQ=","avatar_url":"https://avatars1.githubusercontent.com/u/9434884?v=4","gravatar_id":"","url":"https://api.github.com/users/sczyh30","html_url":"https://github.com/sczyh30","followers_url":"https://api.github.com/users/sczyh30/followers","following_url":"https://api.github.com/users/sczyh30/following{/other_user}","gists_url":"https://api.github.com/users/sczyh30/gists{/gist_id}","starred_url":"https://api.github.com/users/sczyh30/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sczyh30/subscriptions","organizations_url":"https://api.github.com/users/sczyh30/orgs","repos_url":"https://api.github.com/users/sczyh30/repos","events_url":"https://api.github.com/users/sczyh30/events{/privacy}","received_events_url":"https://api.github.com/users/sczyh30/received_events","type":"User","site_admin":false},"created_at":"2019-12-02T07:48:19Z","updated_at":"2019-12-02T07:48:19Z","author_association":"MEMBER","body":"This will be improved in #1042. Further contributions are welcomed!"}}
other: {"actor":{"display_login":"sczyh30"}}