Browse Source

feat(account): my session returns the user id

pull/1306/head
colin 8 months ago
parent
commit
e90725c067
  1. 2
      aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/Dto/IdentitySessionDto.cs
  2. 7
      aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/MyProfileAppService.cs

2
aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/Dto/IdentitySessionDto.cs

@ -14,6 +14,8 @@ public class IdentitySessionDto : EntityDto<Guid>
public string IpAddresses { get; set; }
public Guid UserId { get; set; }
public DateTime SignedIn { get; set; }
public DateTime? LastAccessed { get; set; }

7
aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/MyProfileAppService.cs

@ -75,12 +75,12 @@ public class MyProfileAppService : AccountApplicationServiceBase, IMyProfileAppS
public async virtual Task<PagedResultDto<IdentitySessionDto>> GetSessionsAsync(GetMySessionsInput input)
{
var user = await GetCurrentUserAsync();
var userId = CurrentUser.GetId();
var totalCount = await IdentitySessionRepository.GetCountAsync(
user.Id, input.Device, input.ClientId);
userId, input.Device, input.ClientId);
var identitySessions = await IdentitySessionRepository.GetListAsync(
input.Sorting, input.MaxResultCount, input.SkipCount,
user.Id, input.Device, input.ClientId);
userId, input.Device, input.ClientId);
return new PagedResultDto<IdentitySessionDto>(totalCount,
identitySessions.Select(session => new IdentitySessionDto
@ -90,6 +90,7 @@ public class MyProfileAppService : AccountApplicationServiceBase, IMyProfileAppS
SignedIn = session.SignedIn,
ClientId = session.ClientId,
Device = session.Device,
UserId = session.UserId,
DeviceInfo = session.DeviceInfo,
IpAddresses = session.IpAddresses,
LastAccessed = session.LastAccessed,

Loading…
Cancel
Save