-
Notifications
You must be signed in to change notification settings - Fork 958
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(全局): 新增 HasPermisson 表达式 ,简化接口权限判断表达式
@hasPermission("XXX") @PreAuthorize("@pms.hasPermission('XXX')")
- Loading branch information
Showing
2 changed files
with
80 additions
and
37 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
...on-security/src/main/java/com/pig4cloud/pig/common/security/annotation/HasPermission.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.pig4cloud.pig.common.security.annotation; | ||
|
||
|
||
import org.springframework.security.access.prepost.PreAuthorize; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* 判断是否有权限 | ||
* | ||
* @author lengleng | ||
* @date 2024/07/15 | ||
*/ | ||
@Target({ElementType.METHOD}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@PreAuthorize("@pms.hasPermission('{value}'.split(','))") | ||
public @interface HasPermission { | ||
|
||
/** | ||
* 权限字符串 | ||
* | ||
* @return {@link String[] } | ||
*/ | ||
String[] value(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters