ABS.AccessRight.Generator 2.0.0-alpha1

ABS.AccessRight - Access right generator

A helper source generator that aid in generating boilerplate access right content for some accounting software. Read through the following for a better understanding.

Example

The following example source class will be transformed and generating the next following output code:

  • Source (xml):

    <AccessRight name="APP" description="App Integration">
        <Group name="POSTING" description="Posting document">
            <Entry name="SHOW" description="Show posting document" />
            <Entry name="OPEN" description="Open posting document" />
        </Group>
    
        <Group name="SYNC" description="Synchronize document">
            <Entry name="SHOW" description="Show synchronized document" />
            <Entry name="OPEN" description="Open synchronized document" />
    
            <Group name="CONFIG" description="Synchronize config">
                <Entry name="OPEN" description="Open synchronization config" />
                <Entry name="MODIFY" description="Modify synchronization config" />
            </Group>
        </Group>
    </AccessRight>
    
  • Output:

    // <auto-generated/>
    #nullable disable
    
    using AutoCount.Authentication;
    using System;
    using System.Collections.Generic;
    
    namespace ABS.AccessRight.Generator
    {
        /// <summary>
        /// Reference class that contains all of the recognized access right string
        /// </summary>
        public abstract class AccessRightReference
        {
            public const string APP = "APP";
            public const string APP_POSTING = "APP_POSTING";
            public const string APP_POSTING_SHOW = "APP_POSTING_SHOW";
            public const string APP_POSTING_OPEN = "APP_POSTING_OPEN";
            public const string APP_SYNC = "APP_SYNC";
            public const string APP_SYNC_SHOW = "APP_SYNC_SHOW";
            public const string APP_SYNC_OPEN = "APP_SYNC_OPEN";
            public const string APP_SYNC_CONFIG = "APP_SYNC_CONFIG";
            public const string APP_SYNC_CONFIG_OPEN = "APP_SYNC_CONFIG_OPEN";
            public const string APP_SYNC_CONFIG_MODIFY = "APP_SYNC_CONFIG_MODIFY";
    
            public static void RegisterAccessRights()
            {
                AccessRightMap.AddAccessRightRecord(new AccessRightRecord(APP, null, "App Integration"));
                AccessRightMap.AddAccessRightRecord(new AccessRightRecord(APP_POSTING, APP, "Posting document"));
                AccessRightMap.AddAccessRightRecord(new AccessRightRecord(APP_POSTING_SHOW, APP_POSTING, "Show posting document"));
                AccessRightMap.AddAccessRightRecord(new AccessRightRecord(APP_POSTING_OPEN, APP_POSTING, "Open posting document"));
                AccessRightMap.AddAccessRightRecord(new AccessRightRecord(APP_SYNC, APP, "Synchronize document"));
                AccessRightMap.AddAccessRightRecord(new AccessRightRecord(APP_SYNC_SHOW, APP_SYNC, "Show synchronized document"));
                AccessRightMap.AddAccessRightRecord(new AccessRightRecord(APP_SYNC_OPEN, APP_SYNC, "Open synchronized document"));
                AccessRightMap.AddAccessRightRecord(new AccessRightRecord(APP_SYNC_CONFIG, APP_SYNC, "Synchronize config"));
                AccessRightMap.AddAccessRightRecord(new AccessRightRecord(APP_SYNC_CONFIG_OPEN, APP_SYNC_CONFIG, "Open synchronization config"));
                AccessRightMap.AddAccessRightRecord(new AccessRightRecord(APP_SYNC_CONFIG_MODIFY, APP_SYNC_CONFIG, "Modify synchronization config"));
            }
        }
    }
    

    So one would call AccessRightReference.APP to access the value APP, or registering all available access right via AccessRightRerefence.RegisterAccessRights.

TODO

  • Allow to customize output class name. Currently lock to AccessRightReference
  • Allow to customize output namespace. Currently lock to ABS.AccessRight.Generator
  • Perhaps more that I did not think of?

No packages depend on ABS.AccessRight.Generator.

.NET Standard 2.0

Version Downloads Last updated
2.1.0 1 09/28/2026
2.0.0 5 07/02/2026
2.0.0-alpha2 5 07/01/2026
2.0.0-alpha1 5 07/01/2026
1.1.3 9 03/16/2026
1.1.2 13 01/13/2026
1.1.1 10 01/13/2026
1.1.0 9 01/13/2026
1.0.1 13 10/13/2025