一人多岗,并且多个岗位有同一个功能的功能权限,但是不同的岗位同一个action设置了不同的数据权限
平台默认的从功能菜单中打开功能时,是把所有岗位的数据权限按照and的方法拼接起来的,但是功能的当前执行者是主岗,如果需要数据权限也是主岗的参考下面的方案实现
1.在/BIZ/system/config/interceptor.config.m中定义一个拦截器
import java.lang.reflect.Field;
import org.apache.log4j.Logger;
import com.justep.common.SystemUtils;
import com.justep.system.action.Interceptor;
import com.justep.system.context.ActionContext;
import com.justep.system.context.ContextHelper;
//对于非登录的action, 如果executor没有指定或为*时,强制修改为当前人员成员
public class InitExecutor implements Interceptor{
public static Logger logger = Logger.getLogger(InitExecutor.class);
public void execute() {
ActionContext ac = ContextHelper.getActionContext();
String name = ac.getAction().getName();
if (name.equals("loginAction")
|| name.equals("ntLoginAction")){
//不处理
}else{
try{
String executor = ac.getExecutor();
if (SystemUtils.isEmptyString(executor) || "*".equals(executor)){
String fid = ContextHelper.getPersonMember().getFID();
Field field = ac.getClass().getDeclaredField("executor");
field.setAccessible(true);
field.set(ac, fid);
}
}catch(Exception e){
throw new RuntimeException("初始化executor出错!", e);
}
}
}
}

评一波