InfiniLore.Permissions.Generators 1.3.0

dotnet add package InfiniLore.Permissions.Generators --version 1.3.0                
NuGet\Install-Package InfiniLore.Permissions.Generators -Version 1.3.0                
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.Generators" Version="1.3.0">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add InfiniLore.Permissions.Generators --version 1.3.0                
#r "nuget: InfiniLore.Permissions.Generators, 1.3.0"                
#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.Generators as a Cake Addin
#addin nuget:?package=InfiniLore.Permissions.Generators&version=1.3.0

// Install InfiniLore.Permissions.Generators as a Cake Tool
#tool nuget:?package=InfiniLore.Permissions.Generators&version=1.3.0                

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 net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.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 88 12/17/2024
1.2.1 67 12/16/2024
1.2.1-preview.2 38 12/16/2024
1.2.1-preview.1 34 12/16/2024
1.2.0 76 12/8/2024
1.2.0-preview.20241216204352 39 12/16/2024
1.2.0-preview.20241216202441 37 12/16/2024
1.2.0-preview.20241216185940 41 12/16/2024
1.0.0 79 12/8/2024
0.2.0 84 12/7/2024
0.1.0 86 12/7/2024