|
|
@ -42,8 +42,12 @@ public class ManagerUserInterceptor extends HandlerInterceptorAdapter implements
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
|
|
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
|
|
|
Method method = ((HandlerMethod) handler).getMethod();
|
|
|
|
if (handler instanceof HandlerMethod) {
|
|
|
|
return handleMethod(method, request, response) && super.preHandle(request, response, handler);
|
|
|
|
Method method = ((HandlerMethod) handler).getMethod();
|
|
|
|
|
|
|
|
return handleMethod(method, request, response) && super.preHandle(request, response, handler);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return super.preHandle(request, response, handler);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private boolean handleMethod(Method method, HttpServletRequest request, HttpServletResponse response) {
|
|
|
|
private boolean handleMethod(Method method, HttpServletRequest request, HttpServletResponse response) {
|
|
|
@ -75,7 +79,7 @@ public class ManagerUserInterceptor extends HandlerInterceptorAdapter implements
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (ex != null) {
|
|
|
|
if (ex != null) {
|
|
|
|
String funcId = clazz.getSimpleName() + "." + method.getName();
|
|
|
|
String funcId = clazz.getSimpleName() + "." + method.getName();
|
|
|
|
checkPartnerPermission(request, partner, partnerStatusKey, managerStatusKey,funcId);
|
|
|
|
checkPartnerPermission(request, partner, partnerStatusKey, managerStatusKey, funcId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -85,11 +89,11 @@ public class ManagerUserInterceptor extends HandlerInterceptorAdapter implements
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String funcId = clazz.getSimpleName() + "." + method.getName();
|
|
|
|
String funcId = clazz.getSimpleName() + "." + method.getName();
|
|
|
|
checkPartnerPermission(request, partner, partnerStatusKey, managerStatusKey,funcId);
|
|
|
|
checkPartnerPermission(request, partner, partnerStatusKey, managerStatusKey, funcId);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void checkPartnerPermission(HttpServletRequest request, RequirePartner partner, String partnerStatusKey, String managerStatusKey,String funcId) {
|
|
|
|
private void checkPartnerPermission(HttpServletRequest request, RequirePartner partner, String partnerStatusKey, String managerStatusKey, String funcId) {
|
|
|
|
if (StringUtils.isEmpty(partnerStatusKey) && StringUtils.isEmpty(managerStatusKey)) {
|
|
|
|
if (StringUtils.isEmpty(partnerStatusKey) && StringUtils.isEmpty(managerStatusKey)) {
|
|
|
|
throw new ForbiddenException("error.permission.not_login");
|
|
|
|
throw new ForbiddenException("error.permission.not_login");
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -108,7 +112,7 @@ public class ManagerUserInterceptor extends HandlerInterceptorAdapter implements
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject func = permissionPartnerManager.getPartnerFuncById(funcId);
|
|
|
|
JSONObject func = permissionPartnerManager.getPartnerFuncById(funcId);
|
|
|
|
if(func!=null && StringUtils.isNotEmpty(func.getString("module_id"))){
|
|
|
|
if (func != null && StringUtils.isNotEmpty(func.getString("module_id"))) {
|
|
|
|
JSONArray arr = loginUser.getJSONArray("available_module_ids");
|
|
|
|
JSONArray arr = loginUser.getJSONArray("available_module_ids");
|
|
|
|
if (arr == null || !arr.contains(func.getString("module_id"))) {
|
|
|
|
if (arr == null || !arr.contains(func.getString("module_id"))) {
|
|
|
|
logger.info(partner.toString());
|
|
|
|
logger.info(partner.toString());
|
|
|
|