| 8182 |
amar.kumar |
1 |
package in.shop2020.support.controllers;
|
|
|
2 |
|
|
|
3 |
import in.shop2020.support.utils.ReportsUtils;
|
|
|
4 |
|
|
|
5 |
import java.util.Collection;
|
|
|
6 |
|
|
|
7 |
import javax.servlet.http.HttpServletRequest;
|
|
|
8 |
import javax.servlet.http.HttpSession;
|
|
|
9 |
|
|
|
10 |
import org.apache.struts2.convention.annotation.InterceptorRef;
|
|
|
11 |
import org.apache.struts2.convention.annotation.InterceptorRefs;
|
|
|
12 |
import org.apache.struts2.convention.annotation.Result;
|
|
|
13 |
import org.apache.struts2.convention.annotation.Results;
|
|
|
14 |
import org.apache.struts2.interceptor.ServletRequestAware;
|
|
|
15 |
import org.slf4j.Logger;
|
|
|
16 |
import org.slf4j.LoggerFactory;
|
|
|
17 |
|
|
|
18 |
import com.opensymphony.xwork2.ActionSupport;
|
|
|
19 |
|
|
|
20 |
@SuppressWarnings("serial")
|
|
|
21 |
@InterceptorRefs({
|
|
|
22 |
@InterceptorRef("defaultStack"),
|
|
|
23 |
@InterceptorRef("login")
|
|
|
24 |
})
|
|
|
25 |
@Results({
|
|
|
26 |
@Result(name="authfail", type="redirectAction", params = {"actionName" , "reports"})
|
|
|
27 |
})
|
|
|
28 |
public class EbayDashboardController extends ActionSupport implements ServletRequestAware {
|
|
|
29 |
|
|
|
30 |
private static Logger logger = LoggerFactory.getLogger(EbayDashboardController.class);
|
|
|
31 |
|
|
|
32 |
private HttpServletRequest request;
|
|
|
33 |
private HttpSession session;
|
|
|
34 |
|
|
|
35 |
public String errorMsg = "";
|
|
|
36 |
|
|
|
37 |
public String index() {
|
|
|
38 |
if(!ReportsUtils.canAccessReport((Long)session.getAttribute(ReportsUtils.ROLE), request.getServletPath()))
|
|
|
39 |
return "authfail";
|
|
|
40 |
return "authsuccess";
|
|
|
41 |
}
|
|
|
42 |
|
|
|
43 |
@Override
|
|
|
44 |
public void setServletRequest(HttpServletRequest request) {
|
|
|
45 |
this.request = request;
|
|
|
46 |
this.session = request.getSession();
|
|
|
47 |
}
|
|
|
48 |
|
|
|
49 |
public String getErrorMsg() {
|
|
|
50 |
return errorMsg;
|
|
|
51 |
}
|
|
|
52 |
|
|
|
53 |
public void setErrorMsg(String errorMsg) {
|
|
|
54 |
this.errorMsg = errorMsg;
|
|
|
55 |
}
|
|
|
56 |
|
|
|
57 |
}
|