Starts in:
0 DAY
2 HRS
30 MIN
34 SEC
Starts in:
0 D
2 H
30 M
34 S
Open Closed

The ABP microservice project menu permission cannot be obtained #4871


User avatar
0
guoanjin created
  • ABP Framework version: v6.0& v.7.0
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:" The ABP microservice project menu permission cannot be obtained. Multiple switches to other languages or logouts are required to display it. The backend modification permission and Redis cache data are not updated, resulting in the page menu permission remaining the same. Only after clearing the cache or invalidating the cache can the latest menu permission be obtained
Login to the admin account as shown in the following figure:

Switching languages is shown in the following figure:

Switching languages multiple times and logging out of the permission menu will display normally, as shown in the following figure:


6 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Can you share the full steps to reproduce? thanks

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    I think this problem is more related to your local environment. If you want, I can check it remotely. shiwei.liang@volosoft.com

  • User Avatar
    0
    guoanjin created

    Okay, could you please help me check remotely

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    please email me : shiwei.liang@volosoft.com

  • User Avatar
    0
    guoanjin created

    Okay

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    The problem is related to ApplicationConfigrationCache: https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClient.cs#L42

    The cache time is 5mins by default.

    Starting from 7.1, you can configure the cache expiration time:

    Configure<AbpAspNetCoreMvcClientCacheOptions>(options=>
    {
         options.ApplicationConfigurationDtoCacheAbsoluteExpiration = TimeSpan.FromSeconds(30);
    });
    

    For now, you can reset the cache after user login:

    .AddCookie("Cookies", options =>
    {
        options.ExpireTimeSpan = TimeSpan.FromDays(365);
        var originalHandler = options.Events.OnSignedIn;
        options.Events.OnSignedIn = async signedInContext =>
        {
            await originalHandler.Invoke(signedInContext);
            var currentPrincipalAccessor = signedInContext.HttpContext.RequestServices.GetRequiredService<ICurrentPrincipalAccessor>();
            using (currentPrincipalAccessor.Change(signedInContext.Principal))
            {
                await signedInContext.HttpContext.RequestServices.GetRequiredService<ICurrentApplicationConfigurationCacheResetService>().ResetAsync();
            }
            
        };
    })
    
Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06