feat(backend): only one sensitive data request per 24 hours
This commit is contained in:
parent
db22e35f0d
commit
8edbc8bf1d
2 changed files with 7 additions and 0 deletions
|
@ -64,6 +64,7 @@ public class LookupController(
|
|||
LastSidReroll: user.LastSidReroll,
|
||||
Suspended: user is { Deleted: true, DeletedBy: not null },
|
||||
Deleted: user.Deleted,
|
||||
ShowSensitiveData: showSensitiveData,
|
||||
AuthMethods: showSensitiveData
|
||||
? authMethods.Select(UserRendererService.RenderAuthMethod)
|
||||
: null
|
||||
|
@ -79,6 +80,11 @@ public class LookupController(
|
|||
{
|
||||
User user = await db.ResolveUserAsync(id);
|
||||
|
||||
// Don't let mods accidentally spam the audit log
|
||||
bool alreadyAuthorized = await moderationService.ShowSensitiveDataAsync(CurrentUser!, user);
|
||||
if (alreadyAuthorized)
|
||||
return NoContent();
|
||||
|
||||
AuditLogEntry entry = await moderationService.QuerySensitiveDataAsync(
|
||||
CurrentUser!,
|
||||
user,
|
||||
|
|
|
@ -105,6 +105,7 @@ public record QueryUserResponse(
|
|||
Instant LastSidReroll,
|
||||
bool Suspended,
|
||||
bool Deleted,
|
||||
bool ShowSensitiveData,
|
||||
[property: JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
|
||||
IEnumerable<AuthMethodResponse>? AuthMethods
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue