Beispiel #1
0
        public ActionResult CancelRole(long role)
        {
            var resutl    = new AjaxResult();
            var roleModel = sysRoleBll.GetRoleByID(role);

            if (roleModel == null)
            {
                resutl.flag    = false;
                resutl.message = "未找到角色信息";
                return(Json(resutl));
            }
            var user = Session[Constants.USER_KEY] as User;

            if (roleModel.Corp != user.SysCorp.ID || (roleModel.Type && roleModel.Corp == user.SysCorp.ID))
            {
                resutl.flag    = false;
                resutl.message = "您无权操作该角色信息";
                return(Json(resutl));
            }
            if (roleModel.Canceler != null)
            {
                resutl.flag    = false;
                resutl.message = "角色已注销,无需重复操作!";
                return(Json(resutl));
            }
            if (sysRoleBll.CancelOrActionRole(roleModel.ID, user.SysOperator.ID))
            {
                resutl.flag = true;
                return(Json(resutl));
            }
            resutl.flag    = false;
            resutl.message = "注销失败";
            return(Json(resutl));
        }