mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 17:11:10 +00:00
Implements authorization caching and check in the web client
This commit is contained in:
1 parent
7bca5b1ba3
commit
8eb1b9f13c
108 files changed
+5931
-73
No files matched your search
+1
@@ -73,6 +73,7 @@ public class AuthenticatedLuminaApiFactory : LuminaApiFactory, IDisposable
|
||||
// create test user
|
||||
UserEntity user = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Username = TestUsername!,
|
||||
Password = _hashService.HashString("TestPass123!"),
|
||||
Libraries = [],
|
||||
|
||||
+22
-1
@@ -14,6 +14,7 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Api.IntegrationTests.Common.Setup;
|
||||
@@ -98,7 +99,27 @@ public class LuminaApiFactory : WebApplicationFactory<Program>, IDisposable
|
||||
dbContext.Database.Migrate();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the in-memory SQLite database to its original state.
|
||||
/// </summary>
|
||||
public async Task ResetDatabaseAsync()
|
||||
{
|
||||
using IServiceScope scope = Services.CreateScope();
|
||||
LuminaDbContext context = scope.ServiceProvider.GetRequiredService<LuminaDbContext>();
|
||||
|
||||
context.Books.RemoveRange(context.Books);
|
||||
context.Libraries.RemoveRange(context.Libraries);
|
||||
context.RolePermissions.RemoveRange(context.RolePermissions);
|
||||
context.UserRoles.RemoveRange(context.UserRoles);
|
||||
context.Roles.RemoveRange(context.Roles);
|
||||
context.Permissions.RemoveRange(context.Permissions);
|
||||
context.Users.RemoveRange(context.Users);
|
||||
context.UserPermissions.RemoveRange(context.UserPermissions);
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disposes the connection to the database.
|
||||
|
||||
Reference in new issue
Block a user