将 MiGu.Server 相关忽略规则迁移至 backends/MiGu.Server,并新增对 .tmp-build* 和 /.cursor/rules 的忽略,优化敏感数据与临时文件的管理。
46 lines
1.5 KiB
C#
46 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,
|
|
List<string> AllowedPages);
|