parent
11961dc264
commit
a3ab6bc849
@ -1,94 +0,0 @@
|
||||
package au.com.royalpay.payment.manage.permission.manager;
|
||||
|
||||
import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
|
||||
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* Created by yixian on 2016-06-25.
|
||||
*/
|
||||
@Component
|
||||
public class OperationInterceptor extends HandlerInterceptorAdapter implements Ordered {
|
||||
@Resource
|
||||
private ClientConfigService clientConfigService;
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
Method method = ((HandlerMethod) handler).getMethod();
|
||||
return handleMethod(method, request, response) && super.preHandle(request, response, handler);
|
||||
}
|
||||
|
||||
private boolean handleMethod(Method method, HttpServletRequest request, HttpServletResponse response) {
|
||||
// RequireManager manager = null;
|
||||
// RequirePartner partner = null;
|
||||
// Class clazz = method.getDeclaringClass();
|
||||
// if (AnnotatedElementUtils.isAnnotated(method, RequireManager.class)) {
|
||||
// manager = AnnotatedElementUtils.findMergedAnnotation(method, RequireManager.class);
|
||||
// } else if (AnnotatedElementUtils.isAnnotated(clazz, RequireManager.class)) {
|
||||
// manager = AnnotatedElementUtils.findMergedAnnotation(clazz, RequireManager.class);
|
||||
// }
|
||||
// if (AnnotatedElementUtils.isAnnotated(method, RequirePartner.class)) {
|
||||
// partner = AnnotatedElementUtils.findMergedAnnotation(method, RequirePartner.class);
|
||||
// } else if (AnnotatedElementUtils.isAnnotated(clazz, RequirePartner.class)) {
|
||||
// partner = AnnotatedElementUtils.findMergedAnnotation(clazz, RequirePartner.class);
|
||||
// }
|
||||
// if (manager == null && partner == null) {
|
||||
// return true;
|
||||
// }
|
||||
// String managerStatusKey = HttpUtils.getCookie(request, CommonConsts.MANAGER_STATUS);
|
||||
// String partnerStatusKey = HttpUtils.getCookie(request, CommonConsts.PARTNER_STATUS);
|
||||
// if (manager != null && partner != null) {
|
||||
// ForbiddenException ex = null;
|
||||
// try {
|
||||
// String funcId = clazz.getSimpleName() + "." + method.getName();
|
||||
// checkManagerPermisson(request, funcId, managerStatusKey);
|
||||
// } catch (ForbiddenException e) {
|
||||
// ex = e;
|
||||
// }
|
||||
// if (ex != null) {
|
||||
// checkPartnerPermission(request, partner, partnerStatusKey, managerStatusKey);
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
// if (manager != null) {
|
||||
// String funcId = clazz.getSimpleName() + "." + method.getName();
|
||||
// checkManagerPermisson(request, funcId, managerStatusKey);
|
||||
// return true;
|
||||
// }
|
||||
// checkPartnerPermission(request, partner, partnerStatusKey, managerStatusKey);
|
||||
System.out.println("kira preasjdasljdlasdjalsdjasdljasdjasldjsalkdjaslkdksja");
|
||||
System.out.println("kira preasjdasljdlasdjalsdjasdljasdjasldjsalkdjaslkdksja");
|
||||
System.out.println("kira preasjdasljdlasdjalsdjasdljasdjasldjsalkdjaslkdksja");
|
||||
System.out.println("kira preasjdasljdlasdjalsdjasdljasdjasldjsalkdjaslkdksja");
|
||||
System.out.println("kira preasjdasljdlasdjalsdjasdljasdjasldjsalkdjaslkdksja");
|
||||
System.out.println("kira preasjdasljdlasdjalsdjasdljasdjasldjsalkdjaslkdksja");
|
||||
System.out.println("kira preasjdasljdlasdjalsdjasdljasdjasldjsalkdjaslkdksja");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return 99;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
|
||||
System.out.println("this is afert Completion aslkdasjdasldjlasdjlasdjasjdklas");
|
||||
System.out.println("this is afert Completion aslkdasjdasldjlasdjlasdjasjdklas");
|
||||
System.out.println("this is afert Completion aslkdasjdasldjlasdjlasdjasjdklas");
|
||||
System.out.println("this is afert Completion aslkdasjdasldjlasdjlasdjasjdklas");
|
||||
System.out.println("this is afert Completion aslkdasjdasldjlasdjlasdjasjdklas");
|
||||
System.out.println("this is afert Completion aslkdasjdasldjlasdjlasdjasjdklas");
|
||||
}
|
||||
}
|
Loading…
Reference in new issue