优化数据权限控制处理器

This commit is contained in:
zhouhao
2017-08-16 21:56:48 +08:00
parent 5281031763
commit cd476b8b4f
3 changed files with 6 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
package org.hswebframework.web.authorization.access;
import org.hswebframework.web.boost.aop.context.MethodInterceptorParamContext;
import org.hswebframework.web.authorization.define.AuthorizingContext;
/**
* 数据级别权限控制器,通过此控制器对当前登录用户进行的操作进行数据级别的权限控制。
@@ -13,8 +13,8 @@ public interface DataAccessController {
/**
* 执行权限控制
* @param access 控制方式以及配置
* @param params 当前操作的方法的参数上下文
* @param context 权限验证上下文,用于传递验证过程用到的参数
* @return 授权是否通过
*/
boolean doAccess(DataAccessConfig access, MethodInterceptorParamContext params);
boolean doAccess(DataAccessConfig access, AuthorizingContext context);
}

View File

@@ -1,6 +1,6 @@
package org.hswebframework.web.authorization.access;
import org.hswebframework.web.boost.aop.context.MethodInterceptorParamContext;
import org.hswebframework.web.authorization.define.AuthorizingContext;
/**
* 数据级别权限控制处理器接口,负责处理支持的权限控制配置
@@ -24,5 +24,5 @@ public interface DataAccessHandler {
* @param context 参数上下文
* @return 处理结果
*/
boolean handle(DataAccessConfig access, MethodInterceptorParamContext context);
boolean handle(DataAccessConfig access, AuthorizingContext context);
}

View File

@@ -0,0 +1,39 @@
package org.hswebframework.web.authorization.define;
import org.hswebframework.web.authorization.Authentication;
import org.hswebframework.web.boost.aop.context.MethodInterceptorParamContext;
/**
* 权限控制上下文
*/
public class AuthorizingContext {
private AuthorizeDefinition definition;
private Authentication authentication;
private MethodInterceptorParamContext paramContext;
public AuthorizeDefinition getDefinition() {
return definition;
}
public void setDefinition(AuthorizeDefinition definition) {
this.definition = definition;
}
public Authentication getAuthentication() {
return authentication;
}
public void setAuthentication(Authentication authentication) {
this.authentication = authentication;
}
public MethodInterceptorParamContext getParamContext() {
return paramContext;
}
public void setParamContext(MethodInterceptorParamContext paramContext) {
this.paramContext = paramContext;
}
}