Browse Source
Add new `DeleteAllAsync` method to `IIdentitySessionRepository`.
pull/18242/head
maliming
2 years ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
3 changed files with
12 additions and
0 deletions
-
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IIdentitySessionRepository.cs
-
modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentitySessionRepository.cs
-
modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentitySessionRepository.cs
|
|
|
@ -30,4 +30,6 @@ public interface IIdentitySessionRepository : IBasicRepository<IdentitySession, |
|
|
|
Task DeleteAllAsync(Guid userId, Guid? exceptSessionId = null, CancellationToken cancellationToken = default); |
|
|
|
|
|
|
|
Task DeleteAllAsync(Guid userId, string device, Guid? exceptSessionId = null, CancellationToken cancellationToken = default); |
|
|
|
|
|
|
|
Task DeleteAllAsync(TimeSpan inactiveTimeSpan, CancellationToken cancellationToken = default); |
|
|
|
} |
|
|
|
|
|
|
|
@ -75,4 +75,9 @@ public class EfCoreIdentitySessionRepository : EfCoreRepository<IIdentityDbConte |
|
|
|
{ |
|
|
|
await DeleteAsync(x => x.UserId == userId && x.Device == device && x.Id != exceptSessionId, cancellationToken: cancellationToken); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual async Task DeleteAllAsync(TimeSpan inactiveTimeSpan, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
await DeleteDirectAsync(x => x.LastAccessed == null || x.LastAccessed < DateTime.UtcNow.Subtract(inactiveTimeSpan), cancellationToken: cancellationToken); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -80,4 +80,9 @@ public class MongoIdentitySessionRepository : MongoDbRepository<IAbpIdentityMong |
|
|
|
{ |
|
|
|
await DeleteAsync(x => x.UserId == userId && x.Device == device && x.Id != exceptSessionId, cancellationToken: cancellationToken); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual async Task DeleteAllAsync(TimeSpan inactiveTimeSpan, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
await DeleteDirectAsync(x => x.LastAccessed == null || x.LastAccessed < DateTime.UtcNow.Subtract(inactiveTimeSpan), cancellationToken: cancellationToken); |
|
|
|
} |
|
|
|
} |
|
|
|
|