use of com.artlongs.sys.model.SysUser in project act-eagle-allone by mailtous.
the class SysLoginController method loginCheck.
private R loginCheck(String userName, String pwd, H.Session session, H.Response response) {
R<SysUser> r = sysUserService.checkLogin(userName, pwd);
if (r.isSucc()) {
// 用户登录检查成功,保存到session
SysUser sysUser = r.getItem();
sysUser.saveToSession(session);
// 写cookie
response.addCookie(sysUser.buildMyCookie(sysUser.getId().toString()));
r.getItem().setPwd("");
}
return r;
}
use of com.artlongs.sys.model.SysUser in project act-eagle-allone by mailtous.
the class SysUserController method del.
@PostAction("del/{id}")
public RenderJSON del(Long id) {
SysUser sysUser = sysUserService.get(id);
if (null != sysUser) {
sysUser.setDelStatus(BaseEntity.DELETED);
sysUserService.update(sysUser);
return json(R.success("用户删除成功!"));
}
return json(R.fail("用户删除失败!"));
}
use of com.artlongs.sys.model.SysUser in project act-eagle-allone by mailtous.
the class SysUserController method role_edit.
/**
* 角色分配窗口页
* @param id
* @return
*/
@GetAction("role_box/{userId}")
public RenderAny role_edit(Long userId) {
SysUser sysUser = sysUserService.get(userId);
List<SysRole> sysRoleList = sysRoleService.getAllOfList();
ctx.renderArg("sysRoleList", sysRoleList);
ctx.renderArg("sysUser", sysUser);
ctx.renderArg("roleMap", sysUser.hasRoleMap());
return render("role_box.html");
}
use of com.artlongs.sys.model.SysUser in project act-eagle-allone by mailtous.
the class SysUserController method assignPerm.
/**
* 保存---分配角色
* @param funcId
* @param roleAssignVoList
* @return
*/
@PostAction("assign/role/{userId}")
public RenderJSON assignPerm(Long userId, List<RoleAssignVo> roleAssignVoList) {
SysUser sysUser = sysUserService.get(userId);
if (null == sysUser)
return json(R.fail("用户不存在。"));
R r = sysUserService.assignRole(roleAssignVoList, sysUser);
return json(r);
}
use of com.artlongs.sys.model.SysUser in project act-eagle-allone by mailtous.
the class SysUserService method createNewUser.
/**
* 创建新用户,密码加密过
* @param sysUser
* @return
*/
public R createNewUser(SysUser sysUser) {
R vo = new R<>();
SysUser dbUser = getByName(sysUser.getUserName());
if (null == dbUser) {
// 对前端输入的明文密码,进行加密
sysUser.setEncodePwd(sysUser.getPwd());
sysUser.setCreateDate(new Date());
sysUser.setModifyDate(new Date());
sysUser.setDelStatus(SysUser.UN_DEL);
int r = sysUserDao.save(sysUser);
vo = r > 0 ? vo.setSuccess("用户创建成功!") : vo.setFail("用户创建失败!");
} else {
vo.setFail("用户已经存在!");
}
return vo;
}