Search in sources :

Example 1 with IUser

use of com.qlangtech.tis.manage.common.IUser in project tis by qlangtech.

the class AuthorityCheckAdvice method doIntercept.

@Override
protected String doIntercept(ActionInvocation invocation) throws Exception {
    BasicModule action = (BasicModule) invocation.getAction();
    ActionProxy proxy = invocation.getProxy();
    String namespace = proxy.getNamespace();
    final Method method = action.getExecuteMethod();
    Func func = method.getAnnotation(Func.class);
    final Rundata rundata = BasicModule.getRundataInstance();
    // }
    final IUser user = UserUtils.getUser(ServletActionContext.getRequest(), daoContextGetter.get());
    if (!user.hasLogin() && !(action instanceof LoginAction || StringUtils.startsWith(namespace, "/config"))) {
        rundata.redirectTo("/runtime/login.htm");
        return Action.NONE;
    }
    action.setAuthtoken(user);
    if (func == null) {
        log.debug("target:" + proxy.getActionName() + ",method:" + method.getName() + " has not set FUNC");
        return invocation.invoke();
    }
    // }
    return invocation.invoke();
}
Also used : ActionProxy(com.opensymphony.xwork2.ActionProxy) BasicModule(com.qlangtech.tis.runtime.module.action.BasicModule) Rundata(com.qlangtech.tis.runtime.module.action.BasicModule.Rundata) IUser(com.qlangtech.tis.manage.common.IUser) Method(java.lang.reflect.Method) LoginAction(com.qlangtech.tis.runtime.module.action.LoginAction)

Aggregations

ActionProxy (com.opensymphony.xwork2.ActionProxy)1 IUser (com.qlangtech.tis.manage.common.IUser)1 BasicModule (com.qlangtech.tis.runtime.module.action.BasicModule)1 Rundata (com.qlangtech.tis.runtime.module.action.BasicModule.Rundata)1 LoginAction (com.qlangtech.tis.runtime.module.action.LoginAction)1 Method (java.lang.reflect.Method)1