正在显示
1 个修改的文件
包含
4 行增加
和
3 行删除
| @@ -20,6 +20,7 @@ import com.ruoyi.common.exception.ServiceException; | @@ -20,6 +20,7 @@ import com.ruoyi.common.exception.ServiceException; | ||
| 20 | */ | 20 | */ |
| 21 | public class SecurityUtils | 21 | public class SecurityUtils |
| 22 | { | 22 | { |
| 23 | + | ||
| 23 | /** | 24 | /** |
| 24 | * 用户ID | 25 | * 用户ID |
| 25 | **/ | 26 | **/ |
| @@ -49,7 +50,7 @@ public class SecurityUtils | @@ -49,7 +50,7 @@ public class SecurityUtils | ||
| 49 | throw new ServiceException("获取部门ID异常", HttpStatus.UNAUTHORIZED); | 50 | throw new ServiceException("获取部门ID异常", HttpStatus.UNAUTHORIZED); |
| 50 | } | 51 | } |
| 51 | } | 52 | } |
| 52 | - | 53 | + |
| 53 | /** | 54 | /** |
| 54 | * 获取用户账户 | 55 | * 获取用户账户 |
| 55 | **/ | 56 | **/ |
| @@ -145,7 +146,7 @@ public class SecurityUtils | @@ -145,7 +146,7 @@ public class SecurityUtils | ||
| 145 | public static boolean hasPermi(Collection<String> authorities, String permission) | 146 | public static boolean hasPermi(Collection<String> authorities, String permission) |
| 146 | { | 147 | { |
| 147 | return authorities.stream().filter(StringUtils::hasText) | 148 | return authorities.stream().filter(StringUtils::hasText) |
| 148 | - .anyMatch(x -> Constants.ALL_PERMISSION.contains(x) || PatternMatchUtils.simpleMatch(x, permission)); | 149 | + .anyMatch(x -> Constants.ALL_PERMISSION.equals(x) || PatternMatchUtils.simpleMatch(x, permission)); |
| 149 | } | 150 | } |
| 150 | 151 | ||
| 151 | /** | 152 | /** |
| @@ -171,7 +172,7 @@ public class SecurityUtils | @@ -171,7 +172,7 @@ public class SecurityUtils | ||
| 171 | public static boolean hasRole(Collection<String> roles, String role) | 172 | public static boolean hasRole(Collection<String> roles, String role) |
| 172 | { | 173 | { |
| 173 | return roles.stream().filter(StringUtils::hasText) | 174 | return roles.stream().filter(StringUtils::hasText) |
| 174 | - .anyMatch(x -> Constants.SUPER_ADMIN.contains(x) || PatternMatchUtils.simpleMatch(x, role)); | 175 | + .anyMatch(x -> Constants.SUPER_ADMIN.equals(x) || PatternMatchUtils.simpleMatch(x, role)); |
| 175 | } | 176 | } |
| 176 | 177 | ||
| 177 | } | 178 | } |
-
请 注册 或 登录 后发表评论