Represents a user's permission definition. It stores a validated SteamId, a read-only list of group names and a read-only dictionary of policy entries mapped to integer values, created from provided enumerables.
using SboxSuperuser.Core.Identity;
namespace SboxSuperuser.Core.Permissions;
internal sealed class UserDefinition
{
internal string SteamId { get; }
internal IReadOnlyList<string> Groups { get; }
internal IReadOnlyDictionary<string, int> Entries { get; }
internal UserDefinition( string steamId, IEnumerable<string> groups,
IEnumerable<KeyValuePair<string, int>> entries )
{
SteamId = SteamIdentity.Validate( steamId, nameof( steamId ) );
Groups = PolicyEntries.Groups( groups );
Entries = PolicyEntries.Snapshot( entries );
}
}