支持管理员 账号登陆

pull/3/head
kouxian 8 years ago
parent 70acd84e73
commit 9df9b2f5f1

@ -57,9 +57,17 @@ public class AdminLoginAct {
Subject subject = SecurityUtils.getSubject(); Subject subject = SecurityUtils.getSubject();
ThreadContext.bind(subject); ThreadContext.bind(subject);
subject.login(token); subject.login(token);
Usr usr = usrService.fetch(Cnd.where("usr", "=", "admin")); User user = (User) subject.getPrincipal();
Usr usr = usrService.fetch(Cnd.where("usr", "=", user.getName()));
if (!Lang.isEmpty(usr)) { if (!Lang.isEmpty(usr)) {
session.setAttribute("usr", usr); switch (usr.getRole()) {
case admin: {
session.setAttribute("usr", usr);
break;
}
default:
break;
}
} }
session.setAttribute(Webs.ME, subject.getPrincipal()); session.setAttribute(Webs.ME, subject.getPrincipal());
return new ServerRedirectView("/admin/main.rk"); return new ServerRedirectView("/admin/main.rk");

Loading…
Cancel
Save