fix: user delete audit log
This commit is contained in:
parent
aceb51c21c
commit
8c969cd56f
3 changed files with 29 additions and 1 deletions
|
@ -22,6 +22,7 @@ use tetratto_core::{
|
|||
cache::Cache,
|
||||
model::{
|
||||
auth::{InviteCode, Token, UserSettings},
|
||||
moderation::AuditLogEntry,
|
||||
oauth,
|
||||
permissions::FinePermission,
|
||||
socket::{PacketType, SocketMessage, SocketMethod},
|
||||
|
@ -393,6 +394,16 @@ pub async fn delete_user_request(
|
|||
|
||||
if user.id != id && !user.permissions.check(FinePermission::MANAGE_USERS) {
|
||||
return Json(Error::NotAllowed.into());
|
||||
} else if user.permissions.check(FinePermission::MANAGE_USERS) {
|
||||
if let Err(e) = data
|
||||
.create_audit_log_entry(AuditLogEntry::new(
|
||||
user.id,
|
||||
format!("invoked `delete_user` with x value `{id}`"),
|
||||
))
|
||||
.await
|
||||
{
|
||||
return Json(e.into());
|
||||
}
|
||||
}
|
||||
|
||||
match data
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue