处理未开启分权的情况
This commit is contained in:
parent
521907d6f6
commit
9c3bb5f956
|
|
@ -61,10 +61,6 @@ public class AuthServiceImpl extends Service implements AuthService {
|
||||||
Boolean isOpenDevolution = getTaxAgentService(user).isOpenDevolution();
|
Boolean isOpenDevolution = getTaxAgentService(user).isOpenDevolution();
|
||||||
boolean isAuth = clazz.isAnnotationPresent(Auth.class);
|
boolean isAuth = clazz.isAnnotationPresent(Auth.class);
|
||||||
|
|
||||||
if (!isOpenDevolution || !isAuth) {
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
Auth auth = clazz.getAnnotation(Auth.class);
|
Auth auth = clazz.getAnnotation(Auth.class);
|
||||||
String taxAgentIdField = auth.taxAgentIdField();
|
String taxAgentIdField = auth.taxAgentIdField();
|
||||||
String taxAgentIdFieldGetter = "get" + taxAgentIdField.substring(0, 1).toUpperCase() + taxAgentIdField.substring(1);
|
String taxAgentIdFieldGetter = "get" + taxAgentIdField.substring(0, 1).toUpperCase() + taxAgentIdField.substring(1);
|
||||||
|
|
@ -76,6 +72,34 @@ public class AuthServiceImpl extends Service implements AuthService {
|
||||||
String optsFieldGetter = "get" + optsField.substring(0, 1).toUpperCase() + optsField.substring(1);
|
String optsFieldGetter = "get" + optsField.substring(0, 1).toUpperCase() + optsField.substring(1);
|
||||||
String optsFieldSetter = "set" + optsField.substring(0, 1).toUpperCase() + optsField.substring(1);
|
String optsFieldSetter = "set" + optsField.substring(0, 1).toUpperCase() + optsField.substring(1);
|
||||||
|
|
||||||
|
//不开启分权
|
||||||
|
if (!isOpenDevolution) {
|
||||||
|
if (filterType == AuthFilterTypeEnum.DATA_OPT) {
|
||||||
|
list.forEach(t -> {
|
||||||
|
try {
|
||||||
|
Method optsFieldGetterMethod = t.getClass().getMethod(optsFieldGetter);
|
||||||
|
Set<String> opts = (Set<String>) optsFieldGetterMethod.invoke(t);
|
||||||
|
if (opts == null) {
|
||||||
|
opts = new HashSet<>();
|
||||||
|
}
|
||||||
|
opts.add("query");
|
||||||
|
opts.add("admin");
|
||||||
|
|
||||||
|
Method optsFieldSetterMethod = t.getClass().getMethod(optsFieldSetter, Set.class);
|
||||||
|
optsFieldSetterMethod.invoke(t, opts);
|
||||||
|
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
|
||||||
|
throw new SalaryRunTimeException(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
//未配置分权
|
||||||
|
if (!isAuth) {
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
//给总管理员赋值最大权限
|
//给总管理员赋值最大权限
|
||||||
Boolean isChief = getTaxAgentService(user).isChief((long) user.getUID());
|
Boolean isChief = getTaxAgentService(user).isChief((long) user.getUID());
|
||||||
if (isChief || filterType == AuthFilterTypeEnum.NO_AUTH) {
|
if (isChief || filterType == AuthFilterTypeEnum.NO_AUTH) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue