add: audit log and reports table
TODO: audit log/reports UIs
This commit is contained in:
parent
9a9b72bdbb
commit
b2df2739a7
16 changed files with 387 additions and 6 deletions
|
@ -22,6 +22,8 @@ impl DataManager {
|
|||
execute!(&conn, common::CREATE_TABLE_USERFOLLOWS).unwrap();
|
||||
execute!(&conn, common::CREATE_TABLE_USERBLOCKS).unwrap();
|
||||
execute!(&conn, common::CREATE_TABLE_IPBANS).unwrap();
|
||||
execute!(&conn, common::CREATE_TABLE_AUDITLOG).unwrap();
|
||||
execute!(&conn, common::CREATE_TABLE_REPORTS).unwrap();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -136,6 +138,11 @@ macro_rules! auto_method {
|
|||
if user.id != y.owner {
|
||||
if !user.permissions.check(FinePermission::$permission) {
|
||||
return Err(Error::NotAllowed);
|
||||
} else {
|
||||
self.create_auditlog_entry(crate::model::moderation::AuditLogEntry::new(
|
||||
user.id,
|
||||
format!("invoked `{}` with x value `{id}`", stringify!($name)),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -161,6 +168,11 @@ macro_rules! auto_method {
|
|||
if user.id != y.owner {
|
||||
if !user.permissions.check(FinePermission::$permission) {
|
||||
return Err(Error::NotAllowed);
|
||||
} else {
|
||||
self.create_auditlog_entry(crate::model::moderation::AuditLogEntry::new(
|
||||
user.id,
|
||||
format!("invoked `{}` with x value `{id}`", stringify!($name)),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,6 +200,12 @@ macro_rules! auto_method {
|
|||
if user.id != y.owner {
|
||||
if !user.permissions.check(FinePermission::$permission) {
|
||||
return Err(Error::NotAllowed);
|
||||
} else {
|
||||
self.create_auditlog_entry(crate::model::moderation::AuditLogEntry::new(
|
||||
user.id,
|
||||
format!("invoked `{}` with x value `{id}`", stringify!($name)),
|
||||
))
|
||||
.await?
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -213,6 +231,12 @@ macro_rules! auto_method {
|
|||
if user.id != y.owner {
|
||||
if !user.permissions.check(FinePermission::$permission) {
|
||||
return Err(Error::NotAllowed);
|
||||
} else {
|
||||
self.create_auditlog_entry(crate::model::moderation::AuditLogEntry::new(
|
||||
user.id,
|
||||
format!("invoked `{}` with x value `{x}`", stringify!($name)),
|
||||
))
|
||||
.await?
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -240,6 +264,12 @@ macro_rules! auto_method {
|
|||
if user.id != y.owner {
|
||||
if !user.permissions.check(FinePermission::$permission) {
|
||||
return Err(Error::NotAllowed);
|
||||
} else {
|
||||
self.create_auditlog_entry(crate::model::moderation::AuditLogEntry::new(
|
||||
user.id,
|
||||
format!("invoked `{}` with x value `{id}`", stringify!($name), id),
|
||||
))
|
||||
.await?
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -269,6 +299,12 @@ macro_rules! auto_method {
|
|||
if user.id != y.owner {
|
||||
if !user.permissions.check(FinePermission::$permission) {
|
||||
return Err(Error::NotAllowed);
|
||||
} else {
|
||||
self.create_auditlog_entry(crate::model::moderation::AuditLogEntry::new(
|
||||
user.id,
|
||||
format!("invoked `{}` with x value `{x:?}`", stringify!($name)),
|
||||
))
|
||||
.await?
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -418,6 +454,12 @@ macro_rules! auto_method {
|
|||
if user.id != y.owner {
|
||||
if !user.permissions.check(FinePermission::$permission) {
|
||||
return Err(Error::NotAllowed);
|
||||
} else {
|
||||
self.create_auditlog_entry(crate::model::moderation::AuditLogEntry::new(
|
||||
user.id,
|
||||
format!("invoked `{}` with x value `{id}`", stringify!($name)),
|
||||
))
|
||||
.await?
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -445,6 +487,12 @@ macro_rules! auto_method {
|
|||
if user.id != y.owner {
|
||||
if !user.permissions.check(FinePermission::$permission) {
|
||||
return Err(Error::NotAllowed);
|
||||
} else {
|
||||
self.create_auditlog_entry(crate::model::moderation::AuditLogEntry::new(
|
||||
user.id,
|
||||
format!("invoked `{}` with x value `{x}`", stringify!($name)),
|
||||
))
|
||||
.await?
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -497,6 +545,12 @@ macro_rules! auto_method {
|
|||
if user.id != y.owner {
|
||||
if !user.permissions.check(FinePermission::$permission) {
|
||||
return Err(Error::NotAllowed);
|
||||
} else {
|
||||
self.create_auditlog_entry(crate::model::moderation::AuditLogEntry::new(
|
||||
user.id,
|
||||
format!("invoked `{}` with x value `{x:?}`", stringify!($name)),
|
||||
))
|
||||
.await?
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue