从 Simple-FR 拆出 Platform.Server 并重命名为 MiGu.Server;frontends 源码与构建脚本迁入本仓库。地图监控在 projection/cars 失败或为空时回退 reflection 车辆列表;Simple 仓库已移除旧 Platform.Server。 Co-authored-by: Cursor <cursoragent@cursor.com>
45 lines
1.5 KiB
C#
45 lines
1.5 KiB
C#
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);
|