Open Closed

Sorting in Permission Management #3088

deepak created
  • ABP Framework version: 4.3.3
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no

Is that possible to sort the Permission Management module (Left Menu)? Can we set User created module first and than Identity and so on?

1 Answer(s)
  • 0
    enisn created
    Support Team

    Hi @deepak

    We designed permissions to be kept in a Dictionary. Unfortunately dictionaries in C# aren't designed for being able to be sorted.

    We can consider adding an order to permissions but currently, there is no order in permission groups.

    I can show you a workaround until we'll add that feature.

    • Go to your YourProjectNamePermissionDefinitionProvider in .Application.Contracts project and make a manual ordering like below.
    public override void Define(IPermissionDefinitionContext context)
        // some other permission additions of your app
        // ...
        if (context is PermissionDefinitionContext definitionContext)
            var ordered = definitionContext.Groups.OrderByDescending(...).ToList();
            foreach (var item in ordered)
                definitionContext.Groups.Add(item.Key, item.Value);