mirror of
https://github.com/chylex/Minecraft-Phantom-Panel.git
synced 2024-11-24 22:42:53 +01:00
18 lines
787 B
C#
18 lines
787 B
C#
using System.Collections.Immutable;
|
|
|
|
namespace Phantom.Server.Web.Identity.Data;
|
|
|
|
public sealed record Role(string Name, ImmutableArray<Permission> Permissions) {
|
|
private static readonly List<Role> AllRoles = new ();
|
|
internal static IEnumerable<Role> All => AllRoles;
|
|
|
|
private static Role Register(string name, ImmutableArray<Permission> permissions) {
|
|
var role = new Role(name, permissions);
|
|
AllRoles.Add(role);
|
|
return role;
|
|
}
|
|
|
|
public static readonly Role Administrator = Register("Administrator", Permission.All.ToImmutableArray());
|
|
public static readonly Role InstanceManager = Register("Instance Manager", ImmutableArray.Create(Permission.ViewInstances, Permission.ViewInstanceLogs, Permission.CreateInstances, Permission.ControlInstances, Permission.ViewEvents));
|
|
}
|