Open Closed

Blazor Server: Error when trying to edit role permissions #6422


User avatar
0
tech37 created
  • ABP Framework version: v8.0.0

  • UI Type: Blazor Server

  • Database System: EF Core (SQL Server

    • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:

  • [2023-12-31T11:54:03.626Z] Error: System.Collections.Generic.KeyNotFoundException: The given key 'SettingManagement.Emailing.Test' was not present in the dictionary. at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at Volo.Abp.PermissionManagement.Blazor.Components.PermissionManagementModal.<>c__DisplayClass42_1.

  • Steps to reproduce the issue:

  • When clicking on Identity Management -> Roles (admin role) -> Edit Role permissions i get a server error with the above in both the VS console and http debugger on the browser.

  • I tried creating a new role as well and tried to edit permissions and received the same issue.


3 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I will confirm and fix this. Your question credits refunded.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    We can't reproduce this error in the 8.0 startup template.

    Can you share a simple project? liming.ma@volosoft.com

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I can reproduce the problem. we will fix it. https://github.com/abpframework/abp/pull/18681

    you can try this:

    [Dependency(ReplaceServices = true)]
    [ExposeServices(typeof(PermissionManagementModal))]
    public class MyPermissionManagementModal : PermissionManagementModal
    {
        protected override void SetPermissionDepths(List<PermissionGrantInfoDto> permissions, string currentParent, int currentDepth)
        {
            foreach (var permission in permissions)
            {
                if(permission.Name == "SettingManagement.Emailing.Test")
                {
                {
                    _permissionDepths[permission.Name] = 0;
                }}
            }
            base.SetPermissionDepths(permissions, currentParent, currentDepth);
        }
    }
    
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11