InfiniLore.Permissions 1.2.0-preview.20241216202441

This is a prerelease version of InfiniLore.Permissions.
There is a newer version of this package available.
See the version list below for details.
dotnet add package InfiniLore.Permissions --version 1.2.0-preview.20241216202441                
NuGet\Install-Package InfiniLore.Permissions -Version 1.2.0-preview.20241216202441                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="InfiniLore.Permissions" Version="1.2.0-preview.20241216202441" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add InfiniLore.Permissions --version 1.2.0-preview.20241216202441                
#r "nuget: InfiniLore.Permissions, 1.2.0-preview.20241216202441"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install InfiniLore.Permissions as a Cake Addin
#addin nuget:?package=InfiniLore.Permissions&version=1.2.0-preview.20241216202441&prerelease

// Install InfiniLore.Permissions as a Cake Tool
#tool nuget:?package=InfiniLore.Permissions&version=1.2.0-preview.20241216202441&prerelease                

InfiniLore.Permissions

InfiniLore.Permissions is a lightweight library designed to provide robust and dynamic permission generation through code generation.

Features

  • Attribute-based Configuration: Easily annotate your classes and properties with custom attributes to define permission repositories with ease.
  • Automatic Code Generation: Generate source code for permission repository classes using the PermissionsStoreGenerator to streamline permission handling.
  • Flexible Property Management: Supports various property configurations including static properties and customization of access modifiers.
  • Advanced Naming Options: Includes features such as prefix parsing, obfuscation, and case formatting for enhanced security and readability.

Components

PermissionsStoreGenerator

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.

Attributes

  • PermissionsStoreAttribute: Used to annotate classes that should be considered as permission repositories.
  • PrefixAttribute: Allows a specified prefix to be attached to permission names, enhancing naming consistency and organization.

Usage

To integrate InfiniLore.Permissions in your project:

  1. Decorate your partial classes with the PermissionsStoreAttribute to specify them as target for code generation.
  2. Annotate the properties with PrefixAttribute if you require prefixing permission names.
  3. Build your solution which will trigger the code generator to produce the necessary classes.

Example

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"; }
}
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.3.0 56 12/17/2024
1.2.1 52 12/16/2024
1.2.1-preview.2 38 12/16/2024
1.2.1-preview.1 34 12/16/2024
1.2.0 83 12/8/2024
1.2.0-preview.20241216204352 36 12/16/2024
1.2.0-preview.20241216202441 37 12/16/2024
1.2.0-preview.20241216185940 37 12/16/2024
1.0.0 78 12/8/2024
0.2.0 75 12/7/2024
0.1.0 79 12/7/2024