STRUTS2判断是否有超级权限

来源:互联网 发布:故君子莫大乎与人为善 编辑:程序博客网 时间:2024/04/30 12:35

 

 

 

 

 

 

public

 

 

class SuperAuthorityInterceptor extends

AbstractInterceptor {

 

 

 

@Override

 

 

public String intercept(ActionInvocation invocation) throws

Exception {

ActionContext ctx = invocation.getInvocationContext();

Map session = ctx.getSession();

String username = (String) session.get(

 

"username"

);

 

 

if(username != null && username.equals("q"

)){

 

 

return

invocation.invoke();

}

ctx.put(

 

"tip", "you must login first"

);

 

 

return Action.LOGIN

;

原创粉丝点击