Initial import into Gitea
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Management.Data;
|
||||
using Management.Security;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Management.Controllers.Admin;
|
||||
|
||||
@@ -24,14 +25,9 @@ public sealed class AdminSessionsController : AdminControllerBase
|
||||
/// <summary>
|
||||
/// List sessions with optional filtering.
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
public Task<IActionResult> List(
|
||||
[FromQuery] string? clientId,
|
||||
[FromQuery] string? userId,
|
||||
[FromQuery] bool activeOnly = true,
|
||||
[FromQuery] int limit = 100,
|
||||
CancellationToken ct = default)
|
||||
=> CallProc("spAdminSessions", "list", new { clientId, userId, activeOnly, limit }, ct);
|
||||
[HttpPost("list")]
|
||||
public Task<IActionResult> List([FromBody] JsonElement body, CancellationToken ct)
|
||||
=> CallProc("spAdminSessions", "list", body.ToString(), ct);
|
||||
|
||||
/// <summary>
|
||||
/// Revoke a session.
|
||||
@@ -57,9 +53,10 @@ public sealed class AdminSessionsController : AdminControllerBase
|
||||
/// Cleanup expired sessions.
|
||||
/// </summary>
|
||||
[HttpPost("cleanup")]
|
||||
public Task<IActionResult> Cleanup([FromQuery] int daysOld = 30, CancellationToken ct = default)
|
||||
public Task<IActionResult> Cleanup([FromBody] JsonElement body, CancellationToken ct)
|
||||
{
|
||||
var daysOld = body.TryGetProperty("daysOld", out var d) ? d.GetInt32() : 30;
|
||||
Logger.LogWarning("[Admin] CleanupSessions | DaysOld={DaysOld} | By={User}", daysOld, Client.Email);
|
||||
return CallProc("spAdminSessions", "cleanup", new { daysOld }, ct);
|
||||
return CallProc("spAdminSessions", "cleanup", body.ToString(), ct);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user