perf:代码结构调整

This commit is contained in:
曾文豪
2024-08-08 16:16:21 +08:00
parent b34d9d6242
commit 8dc8709499
23 changed files with 792 additions and 506 deletions

View File

@@ -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, "您无权访问");
}