Browse Source

Clear dynamic claims cache when calling `UpdateUserAsync` method.

pull/19353/head
maliming 2 years ago
parent
commit
4b4bbfd375
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 14
      modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserManager.cs

14
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserManager.cs

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Threading;
using System.Threading.Tasks;
using JetBrains.Annotations;
@ -13,7 +12,6 @@ using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Domain.Services;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.EventBus.Local;
using Volo.Abp.Identity.Settings;
using Volo.Abp.Security.Claims;
using Volo.Abp.Settings;
@ -97,6 +95,18 @@ public class IdentityUserManager : UserManager<IdentityUser>, IDomainService
return await base.DeleteAsync(user);
}
protected async override Task<IdentityResult> UpdateUserAsync(IdentityUser user)
{
var result = await base.UpdateUserAsync(user);
if (result.Succeeded)
{
await DynamicClaimCache.RemoveAsync(AbpDynamicClaimCacheItem.CalculateCacheKey(user.Id, user.TenantId), token: CancellationToken);
}
return result;
}
public virtual async Task<IdentityUser> GetByIdAsync(Guid id)
{
var user = await Store.FindByIdAsync(id.ToString(), CancellationToken);

Loading…
Cancel
Save