| | |
| | | */
|
| | | public class SecurityUtils
|
| | | {
|
| | |
|
| | | /**
|
| | | * 用户ID
|
| | | **/
|
| | |
| | | public static boolean hasPermi(Collection<String> authorities, String permission)
|
| | | {
|
| | | return authorities.stream().filter(StringUtils::hasText)
|
| | | .anyMatch(x -> Constants.ALL_PERMISSION.contains(x) || PatternMatchUtils.simpleMatch(x, permission));
|
| | | .anyMatch(x -> Constants.ALL_PERMISSION.equals(x) || PatternMatchUtils.simpleMatch(x, permission));
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | public static boolean hasRole(Collection<String> roles, String role)
|
| | | {
|
| | | return roles.stream().filter(StringUtils::hasText)
|
| | | .anyMatch(x -> Constants.SUPER_ADMIN.contains(x) || PatternMatchUtils.simpleMatch(x, role));
|
| | | .anyMatch(x -> Constants.SUPER_ADMIN.equals(x) || PatternMatchUtils.simpleMatch(x, role));
|
| | | }
|
| | | }
|