perf:代码结构调整
This commit is contained in:
@@ -61,17 +61,21 @@ public class RoleAuthorityAspect {
|
||||
}
|
||||
}
|
||||
|
||||
boolean isAuthorized;
|
||||
String authority = StrUtil.join("_", classAnnotation.group(), classAnnotation.value());
|
||||
RoleAuthority annotation = signature.getMethod().getAnnotation(RoleAuthority.class);
|
||||
if(annotation == null) {
|
||||
return;
|
||||
if (annotation != null) {
|
||||
// 检查是否是功能点的权限
|
||||
isAuthorized = CollUtil.contains(authorityList, StrUtil.join("_", authority, annotation.value()));
|
||||
} else {
|
||||
// 检查是否有menu的权限
|
||||
isAuthorized = !authorityList.stream().filter(it -> StrUtil.startWith(it, authority))
|
||||
.collect(Collectors.toList()).isEmpty();
|
||||
}
|
||||
|
||||
// 检查是否是功能点的权限
|
||||
if (CollUtil.contains(authorityList, StrUtil.join("_", authority, annotation.value()))) {
|
||||
if (isAuthorized) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw new ApiException(403, "您无权访问");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user