⚡角色管理优化
This commit is contained in:
parent
56c4b8897b
commit
31980c80bb
@ -1,26 +1,24 @@
|
||||
using Infrastructure.Constant;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Infrastructure.Model
|
||||
{
|
||||
public class ApiResult : Dictionary<string, object>
|
||||
{
|
||||
/** 状态码 */
|
||||
/// <summary>
|
||||
/// 状态码
|
||||
/// </summary>
|
||||
public static readonly string CODE_TAG = "code";
|
||||
|
||||
/** 返回内容 */
|
||||
/// <summary>
|
||||
/// 返回内容
|
||||
/// </summary>
|
||||
public static readonly string MSG_TAG = "msg";
|
||||
|
||||
/** 数据对象 */
|
||||
public static readonly string DATA_TAG = "data";
|
||||
//public int Code { get; set; }
|
||||
//public string Msg { get; set; }
|
||||
/// <summary>
|
||||
/// 如果data值为null,则忽略序列化将不会返回data字段
|
||||
/// 数据对象
|
||||
/// </summary>
|
||||
//[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
|
||||
//public object Data { get; set; }
|
||||
public static readonly string DATA_TAG = "data";
|
||||
|
||||
/// <summary>
|
||||
/// 初始化一个新创建的APIResult对象,使其表示一个空消息
|
||||
@ -55,6 +53,7 @@ namespace Infrastructure.Model
|
||||
Add(DATA_TAG, data);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回成功消息
|
||||
/// </summary>
|
||||
@ -125,9 +124,4 @@ namespace Infrastructure.Model
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public class ApiResult<T> : ApiResult
|
||||
{
|
||||
public T Result { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -168,7 +168,7 @@ namespace ZR.Admin.WebApi.Controllers.System
|
||||
/// <returns></returns>
|
||||
[Log(BusinessType = BusinessType.EXPORT, IsSaveResponseData = false, Title = "角色导出")]
|
||||
[HttpGet("export")]
|
||||
//[ActionPermissionFilter(Permission = "system:role:export")]
|
||||
[ActionPermissionFilter(Permission = "system:role:export")]
|
||||
public IActionResult Export()
|
||||
{
|
||||
var list = sysRoleService.SelectRoleAll();
|
||||
@ -184,7 +184,7 @@ namespace ZR.Admin.WebApi.Controllers.System
|
||||
/// <returns></returns>
|
||||
[Log(BusinessType = BusinessType.EXPORT, IsSaveResponseData = false, Title = "角色菜单导出")]
|
||||
[HttpGet("exportRoleMenu")]
|
||||
[AllowAnonymous]
|
||||
[ActionPermissionFilter(Permission = "system:role:export")]
|
||||
public IActionResult ExportRoleMenu(int roleId)
|
||||
{
|
||||
MenuQueryDto dto = new() { Status = "0", MenuTypeIds = "M,C,F" };
|
||||
|
||||
@ -82,10 +82,11 @@ namespace ZR.ServiceCore.Middleware
|
||||
if (!HasPermi && !Permission.Equals("common"))
|
||||
{
|
||||
logger.Info($"用户{info.UserName}没有权限访问{url},当前权限[{Permission}]");
|
||||
JsonResult result = new(new ApiResult((int)ResultCode.FORBIDDEN, $"你当前没有权限[{Permission}]访问,请联系管理员", url))
|
||||
JsonResult result = new(new ApiResult((int)ResultCode.FORBIDDEN, $"你当前没有权限访问,请联系管理员", url))
|
||||
{
|
||||
ContentType = "application/json",
|
||||
};
|
||||
context.HttpContext.Response.StatusCode = 403;
|
||||
context.Result = result;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user