using System; namespace ln.identities { [Flags] public enum Role : int { /* Bits 0..15: Rolleneigenschaften */ VIEW = (1<<0), // Authentifizierte Identität darf die effektive Identität und ihre Eigenschaften sehen USE = VIEW | (1 << 1), // Authentifizierte Identität darf die effektive Identität nutzen (z.B. Dateien einer Webpräsenz pflegen) CONTROL = VIEW | (1<<2), // Authentifizierte Identität darf die effektive Identität steuern (z.B. einen Dienst starten / stoppen) MANAGE = VIEW | CONTROL | (1<<3), // Authentifizierte Identität darf die Eigenschaften der effektiven Identität verändern ("Konfiguration") ADMIN = 0x0000FFFF, /* Bits 16..23: */ MANAGEROLES = (1<<16), /* Bits 24..31: Vererbung, Superuser */ IMPERSONATE = (1<<24), // FLAG: Identität erhält alle maskierten Rollen der effektiven Identität, welche direkt assoziiert sind OWN = 0x0FFFFFFF, BE = 0x0000FFFF, SUPER = 0x7FFFFFFF, // SuperUser } //public class Role //{ // public static readonly Role SuperUser = new Role(Guid.Parse("{eefca5e2-2295-44d5-9b24-000000000000}"),"SuperUser"); // public static readonly Role Owner = new Role(Guid.Parse("{eefca5e2-2295-44d5-9b24-000000000001}"), "Owner"); // public static readonly Role Editor = new Role(Guid.Parse("{eefca5e2-2295-44d5-9b24-000000000002}"), "Editor"); // public static readonly Role Reader = new Role(Guid.Parse("{eefca5e2-2295-44d5-9b24-000000000004}"), "Reader"); // public static readonly Role Writer = new Role(Guid.Parse("{eefca5e2-2295-44d5-9b24-000000000008}"), "Writer"); // public Guid UniqueID { get; } // public String Name { get; set; } // private Role() // {} // public Role(string roleName):this(Guid.NewGuid(),roleName){} // public Role(Guid uniqueID,string roleName) // { // UniqueID = uniqueID; // Name = roleName; // } // public override bool Equals(object obj) => (obj is Role other) && other.UniqueID.Equals(UniqueID); // public override int GetHashCode() => UniqueID.GetHashCode(); //} }