Browse Source

identity - implement concurrency stamp

pull/9838/head
enisn 5 years ago
parent
commit
603f094b1e
  1. 7
      modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/ProfileDto.cs
  2. 3
      modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/UpdateProfileDto.cs
  3. 6
      modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs
  4. 4
      modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs
  5. 3
      modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/ProfileAppService.cs

7
modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/ProfileDto.cs

@ -1,8 +1,9 @@
using Volo.Abp.ObjectExtending;
using Volo.Abp.Domain.Entities;
using Volo.Abp.ObjectExtending;
namespace Volo.Abp.Identity
{
public class ProfileDto : ExtensibleObject
public class ProfileDto : ExtensibleObject, IHasConcurrencyStamp
{
public string UserName { get; set; }
@ -17,5 +18,7 @@ namespace Volo.Abp.Identity
public bool IsExternal { get; set; }
public bool HasPassword { get; set; }
public string ConcurrencyStamp { get; set; }
}
}

3
modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/UpdateProfileDto.cs

@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities;
using Volo.Abp.ObjectExtending;
using Volo.Abp.Validation;
@ -20,5 +21,7 @@ namespace Volo.Abp.Identity
[DynamicStringLength(typeof(IdentityUserConsts), nameof(IdentityUserConsts.MaxPhoneNumberLength))]
public string PhoneNumber { get; set; }
public string ConcurrencyStamp { get; set; }
}
}

6
modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs

@ -4,6 +4,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Data;
using Volo.Abp.ObjectExtending;
namespace Volo.Abp.Identity
@ -72,8 +73,9 @@ namespace Volo.Abp.Identity
[Authorize(IdentityPermissions.Roles.Update)]
public virtual async Task<IdentityRoleDto> UpdateAsync(Guid id, IdentityRoleUpdateDto input)
{
var role = await RoleManager.GetByIdAsync(id);
role.ConcurrencyStamp = input.ConcurrencyStamp;
var role = await RoleManager.GetByIdAsync(id);
role.SetConcurrencyStamp(input.ConcurrencyStamp);
(await RoleManager.SetRoleNameAsync(role, input.Name)).CheckErrors();

4
modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs

@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Options;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Data;
using Volo.Abp.ObjectExtending;
namespace Volo.Abp.Identity
@ -98,7 +99,8 @@ namespace Volo.Abp.Identity
await IdentityOptions.SetAsync();
var user = await UserManager.GetByIdAsync(id);
user.ConcurrencyStamp = input.ConcurrencyStamp;
user.SetConcurrencyStamp(input.ConcurrencyStamp);
(await UserManager.SetUserNameAsync(user, input.UserName)).CheckErrors();

3
modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/ProfileAppService.cs

@ -4,6 +4,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Options;
using Volo.Abp.Data;
using Volo.Abp.Identity.Settings;
using Volo.Abp.ObjectExtending;
using Volo.Abp.Settings;
@ -62,6 +63,8 @@ namespace Volo.Abp.Identity
user.Name = input.Name;
user.Surname = input.Surname;
user.SetConcurrencyStamp(input.ConcurrencyStamp);
input.MapExtraPropertiesTo(user);
(await UserManager.UpdateAsync(user)).CheckErrors();

Loading…
Cancel
Save