Open Closed

Menu items not getting refreshed after the current user role is updated. #6888


User avatar
0
neethucp created

Hi, we need to refresh the blazor menu items after the current user role is updated. After the user role is updated, we are invoking ICurrentApplicationConfigurationCacheResetService ResetAsync method to reset the cache and call Challenge method as mentioned in this link. https://support.abp.io/QA/Questions/5537/Refresh-Token-in-Blazor-Server-App. It was working till abp v8.0.0 update. After updating abp to v8.0.0, the menu items are no longer getting refreshed. Can you please guide us on what has changed and how to fix this issue?

  • ABP Framework version: v8.0.2
  • UI Type: Blazor Server
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes

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

    hi

    we are invoking ICurrentApplicationConfigurationCacheResetService ResetAsync method to reset the cache a

    Can you check the Redis to see the ApplicationConfigurationDto cache?

    It was working till abp v8.0.0 update. After updating abp to v8.0.0, the menu items are no longer getting refreshed. Can you please guide us on what has changed and how to fix this issue?

    There are no changes in 8.0. How can I reproduce your problem in a new template project?

    Thanks

  • User Avatar
    0
    neethucp created

    Hi, The cache is getting cleared but after updating the role and invoking challenge method, the policies are not updated in the cache. It only appears if we log out and log in again. We have reproduced the issue in a template project. Can you please share the support email id so that we can sent it to you?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    liming.ma@volosoft.com

    Please include steps. Thanks.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Please update TestService as below:

    namespace TestProject8.Test
    {
        public class TestService: ApplicationService, ITestService
        {
            private IdentityUserManager _userManager;
            private IDistributedCache<AbpDynamicClaimCacheItem> _dynamicClaimCache;
    
            public TestService(IdentityUserManager userManager, IDistributedCache<AbpDynamicClaimCacheItem> dynamicClaimCache)
            {
                _userManager = userManager;
                _dynamicClaimCache = dynamicClaimCache;
            }
            public async Task AddToRoleAsync(Guid id)
            {
                var user = await _userManager.FindByIdAsync(id.ToString());
                if (user == null)
                {
                    return;
                }
                await _userManager.AddToRoleAsync(user, "External");
                await _dynamicClaimCache.RemoveAsync(AbpDynamicClaimCacheItem.CalculateCacheKey(user.Id, user.TenantId));
            }
        }
    }
    
    
  • User Avatar
    0
    neethucp created

    It is working now. Thank you for the fix.

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11