Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
meibuyu-micro
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
without authentication
meibuyu-micro
Commits
a35ed375
Commit
a35ed375
authored
Apr 09, 2020
by
王源
🎧
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
编写鉴权注解文档
parent
729b0ce7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
1 deletion
+43
-1
README.md
README.md
+43
-1
No files found.
README.md
View file @
a35ed375
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
"repositories": {
"repositories": {
"meibuyu/micro": {
"meibuyu/micro": {
"type": "path",
"type": "path",
"url": "
d:/workspace/biubiubiu
",//本库的具体地址,随意找个地方git clone下来
"url": "
path/to/micro
",//本库的具体地址,随意找个地方git clone下来
"options": {
"options": {
"symlink": true
"symlink": true
}
}
...
@@ -18,3 +18,45 @@
...
@@ -18,3 +18,45 @@
```
```
composer require meibuyu/micro @dev
composer require meibuyu/micro @dev
```
```
---
### 2、鉴权注解使用方法
> 使用时必须接入用户服务
> 权限名会拼接env文件中的APP_NAME属性,请注意唯一性
> 所有权限必须存在于用户服务的权限表中,若不存在,请联系管理员添加权限
##### 1、@AutoPerm
在控制器头部添加@AutoPerm注解,为该控制器下所有的方法添加鉴权功能,生成的权限名为
`小写控制名_方法名`
```
/**
* @AutoPerm()
*/
class UserController {}
```
参数:
> 1. prefix, 前缀(字符串),默认为小写控制器名(user)
> 2. exclude, 要排除的方法名(字符串数组),默认为空
```
/**
* @AutoPerm(prefix="user", exclude={"index"})
*/
class UserController {}
```
##### 2、@Perm
在控制器中的方法头部添加@Perm注解,为当前方法添加鉴权功能,生成权限名为
`小写控制名_方法名`
```
/**
* @Perm()
*/
function get_user {}
```
参数:
> name, 前缀(字符串),默认为小写控制器名拼接方法名(user),如果填写指定的名称,会覆盖@AutoPerm的prefix和exclude
```
/**
* @Perm("get_user")
*/
function get_user {}
```
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment