Search in sources :

Example 1 with SysUser

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;
}
Also used : SysUser(com.artlongs.sys.model.SysUser)

Example 2 with SysUser

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("用户删除失败!"));
}
Also used : SysUser(com.artlongs.sys.model.SysUser) PostAction(org.osgl.mvc.annotation.PostAction)

Example 3 with SysUser

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");
}
Also used : SysUser(com.artlongs.sys.model.SysUser) SysRole(com.artlongs.sys.model.SysRole) GetAction(org.osgl.mvc.annotation.GetAction)

Example 4 with SysUser

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);
}
Also used : R(com.artlongs.framework.vo.R) SysUser(com.artlongs.sys.model.SysUser) PostAction(org.osgl.mvc.annotation.PostAction)

Example 5 with SysUser

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;
}
Also used : R(com.artlongs.framework.vo.R) SysUser(com.artlongs.sys.model.SysUser) Date(java.util.Date)

Aggregations

SysUser (com.artlongs.sys.model.SysUser)9 R (com.artlongs.framework.vo.R)3 GetAction (org.osgl.mvc.annotation.GetAction)2 PostAction (org.osgl.mvc.annotation.PostAction)2 SysRole (com.artlongs.sys.model.SysRole)1 Date (java.util.Date)1 H (org.osgl.http.H)1