A library to handle credentials more easily for the InfiniLore server
$ dotnet add package InfiniLore.CredentialsInfiniLore.Permissions is a lightweight library designed to provide robust and dynamic permission generation through code generation.
PermissionsStoreGenerator to streamline permission handling.The main class responsible for generating source code for permission repository classes.
It operates by registering syntax nodes that qualify as candidates based on the PermissionsStore attribute using
Roslyn's incremental generator APIs.
To integrate InfiniLore.Permissions in your project:
PermissionsStoreAttribute to specify them as target for code generation.PrefixAttribute if you require prefixing permission names.Here's a quick example on how to define a permission repository: (The use of a static class isn't necessary but is advised)
using InfiniLore.Permissions;
[PermissionsStore(GeneratorFlags.ParsePrefix)]
public static partial class Permissions {
[Prefix("data.user")] public static partial string LorescopesRead { get; }
}
Will generate
// <auto-generated />
namespace InfiniLore.Permissions.Generators.Sample;
public partial class Permissions {
public static partial string LorescopesRead { get => "data.user.lorescopes.read"; }
}