初始化 MiGu.Server 项目,包含基本的 ASP.NET Core 8 配置、JWT 鉴权、RBAC 权限管理、YARP 反向代理及相关配置文件。新增 build-and-run 脚本以简化构建与运行流程,添加 README 文档以指导用户快速上手。
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
namespace MiGu.Server.Configs;
|
||||
|
||||
public record WidgetGrantDto(string WidgetId, string Visibility);
|
||||
|
||||
public record AuthRole(
|
||||
string Id, string Name, string Scope,
|
||||
List<string> Permissions,
|
||||
List<WidgetGrantDto> WidgetGrants);
|
||||
|
||||
public record AuthUser(string Id, string Username, List<string> Roles, bool Enabled);
|
||||
|
||||
public record AuthRoleConfig(List<AuthRole> Roles, List<AuthUser> Users)
|
||||
{
|
||||
public static AuthRoleConfig Default() => new(
|
||||
Roles: new List<AuthRole>
|
||||
{
|
||||
new("role-admin", "管理员", "Platform",
|
||||
new List<string> { "*" },
|
||||
new List<WidgetGrantDto>()),
|
||||
new("role-ops", "运营", "RCSMonitor",
|
||||
new List<string>
|
||||
{
|
||||
"ops.car.pause", "ops.car.resume", "ops.car.gohome",
|
||||
"ops.task.pause", "ops.task.cancel", "ops.task.reassign",
|
||||
"ops.task.boostPriority", "monitor.note.write"
|
||||
},
|
||||
new List<WidgetGrantDto>
|
||||
{
|
||||
new("MapEditor", "readonly"),
|
||||
new("CadToolbar", "hidden")
|
||||
})
|
||||
},
|
||||
Users: new List<AuthUser>
|
||||
{
|
||||
new("u-admin", "admin", new List<string> { "role-admin" }, true),
|
||||
new("u-ops", "ops", new List<string> { "role-ops" }, true)
|
||||
});
|
||||
}
|
||||
|
||||
public record EffectivePermissions(
|
||||
string UserId,
|
||||
int Version,
|
||||
List<string> AllowedOps,
|
||||
List<WidgetGrantDto> VisibleWidgets,
|
||||
List<string> AllowedPages);
|
||||
Reference in New Issue
Block a user