Search in sources :

Example 36 with AjaxJson

use of com.cdeledu.common.base.AjaxJson in project wechat by dllwh.

the class SysUserOperateController method clearRoleByUserIds.

/**
 * @方法描述: 根据用户id清空角色
 * @return
 */
@ResponseBody
@RequestMapping(value = "roleAssign", params = "clearRoleUser")
@SystemLog(desc = "用户-角色(解除授权)", opType = SysOpType.INSERT, tableName = "sys_user")
public AjaxJson clearRoleByUserIds(SysUserRole sysUserRole) {
    AjaxJson resultMsg = new AjaxJson();
    if (sysUserRole.getUserId() != null) {
        if (WebUtilHelper.getCurrentUserId() != sysUserRole.getUserId()) {
            try {
                manageruserService.deleteUserRole(sysUserRole);
            } catch (Exception e) {
                e.printStackTrace();
                resultMsg.setSuccess(false);
                resultMsg.setResultCode(500);
                resultMsg.setMsg(MessageConstant.MSG_OPERATION_FAILED);
            }
        } else {
            resultMsg.setSuccess(false);
            resultMsg.setResultCode(500);
            resultMsg.setMsg("不能解除当前用户权限");
        }
    }
    // 超级管理员不能删除
    return resultMsg;
}
Also used : AjaxJson(com.cdeledu.common.base.AjaxJson) SystemLog(com.cdeledu.core.annotation.SystemLog) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 37 with AjaxJson

use of com.cdeledu.common.base.AjaxJson in project wechat by dllwh.

the class IconController method del.

/**
 * @方法描述: 删除图标
 * @创建者: 皇族灬战狼
 * @创建时间: 2016年9月22日 下午2:25:30
 * @param request
 * @return
 */
@RequestMapping(params = "delIcon")
@ResponseBody
public AjaxJson del(HttpServletRequest request) {
    AjaxJson result = new AjaxJson();
    // 删除图标时先检查该图标是否正在使用
    boolean isPermit = false;
    if (isPermit) {
    }
    return result;
}
Also used : AjaxJson(com.cdeledu.common.base.AjaxJson) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 38 with AjaxJson

use of com.cdeledu.common.base.AjaxJson in project wechat by dllwh.

the class LoginController method resetPwd.

@ResponseBody
@RequestMapping(value = "resetPwd")
@SystemLog(desc = "重置密码", opType = SysOpType.UPDATE, tableName = "sys_user")
public AjaxJson resetPwd(String oldPassWord, String newPassWord) {
    AjaxJson result = new AjaxJson();
    SysUser currenLoginUser = ShiroHelper.getPrincipal();
    // 判断用户是否为空,不为空,则清空session中的用户object
    if (currenLoginUser != null) {
        if (StringUtils.isNoneBlank(oldPassWord) && StringUtils.isNoneBlank(newPassWord)) {
            String password = PasswordUtil.encrypt(currenLoginUser.getUserName(), oldPassWord.trim());
            if (currenLoginUser.getPassword().equalsIgnoreCase(password)) {
                SysUser sysUser = new SysUser();
                sysUser.setId(currenLoginUser.getId());
                sysUser.setPassword(PasswordUtil.encrypt(currenLoginUser.getUserName(), newPassWord.trim()));
                try {
                    userService.update(sysUser);
                    result.setSuccess(true);
                    result.setMsg(MessageConstant.MSG_OPERATION_SUCCESS);
                } catch (Exception e) {
                    e.printStackTrace();
                    result.setSuccess(false);
                    result.setMsg(MessageConstant.MSG_OPERATION_FAILED);
                }
            } else {
                result.setSuccess(false);
                result.setMsg("错误提示:请输入正确的原密码");
            }
        } else {
            result.setSuccess(false);
            result.setMsg("错误提示:旧密码或新密码不能为空");
        }
    } else {
        result.setSuccess(false);
        result.setMsg("当前用户尚未登录,请重新登录");
    }
    return result;
}
Also used : SysUser(com.cdeledu.model.rbac.SysUser) AjaxJson(com.cdeledu.common.base.AjaxJson) SystemLog(com.cdeledu.core.annotation.SystemLog) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 39 with AjaxJson

use of com.cdeledu.common.base.AjaxJson in project wechat by dllwh.

the class MenuOperateController method createMenu.

/**
 * ----------------------------------------------------- Fields end
 */
@ResponseBody
@RequestMapping(value = "createMenu", method = RequestMethod.POST)
@SystemLog(desc = "创建权限菜单", opType = SysOpType.INSERT, tableName = "sys_menu")
public AjaxJson createMenu(ModelMap map, SysMenu menu) {
    AjaxJson ajaxJson = new AjaxJson();
    int resultCount = -1;
    try {
        if (menu.getType() == SysMenuType.BUTTON.getValue()) {
            SysMenu parentmMenu = new SysMenu();
            parentmMenu.setId(menu.getParentCode());
            if (sysMenuService.findOneForJdbc(parentmMenu).getType() == SysMenuType.MENU.getValue()) {
                resultCount = sysMenuService.insert(menu);
            } else {
                ajaxJson.setSuccess(false);
                ajaxJson.setMsg("禁止为菜单目录创建按钮权限");
            }
        } else {
            resultCount = sysMenuService.insert(menu);
        }
        if (resultCount == 1) {
            // 分配给超级管理员
            try {
                roleService.saveRoleAccess(1, menu.getId());
            } catch (Exception e) {
            }
        }
    } catch (Exception e) {
        ajaxJson.setSuccess(false);
        ajaxJson.setMsg(MessageConstant.MSG_OPERATION_SUCCESS);
    }
    return ajaxJson;
}
Also used : SysMenu(com.cdeledu.model.rbac.SysMenu) AjaxJson(com.cdeledu.common.base.AjaxJson) SystemLog(com.cdeledu.core.annotation.SystemLog) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 40 with AjaxJson

use of com.cdeledu.common.base.AjaxJson in project wechat by dllwh.

the class MenuOperateController method delDisable.

@ResponseBody
@RequestMapping(value = "updateMenu", params = "delDisable")
@SystemLog(desc = "禁止删除菜单", opType = SysOpType.UPDATE, tableName = "sys_menu")
public AjaxJson delDisable(SysMenu sysMenu) {
    AjaxJson ajaxJson = new AjaxJson();
    ajaxJson.setMsg(MessageConstant.SUCCESS_ENABLE_FALSE);
    return ajaxJson;
}
Also used : AjaxJson(com.cdeledu.common.base.AjaxJson) SystemLog(com.cdeledu.core.annotation.SystemLog) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

AjaxJson (com.cdeledu.common.base.AjaxJson)46 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)44 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)33 SystemLog (com.cdeledu.core.annotation.SystemLog)25 ExceptionHandler (org.springframework.web.bind.annotation.ExceptionHandler)12 SysUser (com.cdeledu.model.rbac.SysUser)8 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)6 SysRole (com.cdeledu.model.rbac.SysRole)4 SysMenu (com.cdeledu.model.rbac.SysMenu)3 SysUserRole (com.cdeledu.model.rbac.SysUserRole)2 SysIcon (com.cdeledu.model.system.SysIcon)1 Map (java.util.Map)1 HttpSession (javax.servlet.http.HttpSession)1 AuthenticationException (org.apache.shiro.authc.AuthenticationException)1 DisabledAccountException (org.apache.shiro.authc.DisabledAccountException)1 ExcessiveAttemptsException (org.apache.shiro.authc.ExcessiveAttemptsException)1 ExpiredCredentialsException (org.apache.shiro.authc.ExpiredCredentialsException)1 IncorrectCredentialsException (org.apache.shiro.authc.IncorrectCredentialsException)1 LockedAccountException (org.apache.shiro.authc.LockedAccountException)1 UnknownAccountException (org.apache.shiro.authc.UnknownAccountException)1