mirror of
https://github.com/hs-web/hsweb-framework.git
synced 2026-05-17 11:47:26 +08:00
优化权限控制逻辑
This commit is contained in:
@@ -51,8 +51,8 @@ public class AopAuthorizingController extends StaticMethodMatcherPointcutAdvisor
|
||||
|
||||
MethodInterceptorContext paramContext = holder.createParamContext();
|
||||
|
||||
AuthorizeDefinition definition = aopMethodAuthorizeDefinitionParser.parse(methodInvocation.getThis().getClass(), methodInvocation.getMethod());
|
||||
Object result = true;
|
||||
AuthorizeDefinition definition = aopMethodAuthorizeDefinitionParser.parse(methodInvocation.getThis().getClass(), methodInvocation.getMethod(), paramContext);
|
||||
Object result = null;
|
||||
boolean isControl = false;
|
||||
if (null != definition) {
|
||||
Authentication authentication = Authentication.current().orElseThrow(UnAuthorizedException::new);
|
||||
|
||||
@@ -52,7 +52,7 @@ public class DefaultAopMethodAuthorizeDefinitionParser implements AopMethodAutho
|
||||
CacheKey key = buildCacheKey(target, method);
|
||||
|
||||
AuthorizeDefinition definition = cache.get(key);
|
||||
if ((definition instanceof EmptyAuthorizeDefinition)) {
|
||||
if (definition instanceof EmptyAuthorizeDefinition) {
|
||||
return null;
|
||||
}
|
||||
if (null != definition) {
|
||||
@@ -64,10 +64,9 @@ public class DefaultAopMethodAuthorizeDefinitionParser implements AopMethodAutho
|
||||
.map(customer -> customer.parse(target, method, context))
|
||||
.filter(Objects::nonNull)
|
||||
.findAny().orElse(null);
|
||||
if (definition == null || definition instanceof EmptyAuthorizeDefinition) {
|
||||
return null;
|
||||
if (definition != null && !(definition instanceof EmptyAuthorizeDefinition)) {
|
||||
return definition;
|
||||
}
|
||||
|
||||
}
|
||||
Authorize classAuth = AopUtils.findAnnotation(target, Authorize.class);
|
||||
Authorize methodAuth = AopUtils.findMethodAnnotation(target, method, Authorize.class);
|
||||
|
||||
Reference in New Issue
Block a user