mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-11-26 13:31:02 +00:00
Implement AsObject07 for User
This commit is contained in:
parent
c1b9ebdae6
commit
ab126563f3
1 changed files with 16 additions and 1 deletions
|
@ -11,7 +11,9 @@ use activitypub::{
|
|||
object::{Image, Tombstone},
|
||||
Activity, CustomObject, Endpoint,
|
||||
};
|
||||
use activitystreams::{actor::AsApActor, object::AsObject as _, prelude::*};
|
||||
use activitystreams::{
|
||||
activity::Delete as Delete07, actor::AsApActor, object::AsObject as _, prelude::*,
|
||||
};
|
||||
use chrono::{NaiveDateTime, Utc};
|
||||
use diesel::{self, BelongingToDsl, ExpressionMethods, OptionalExtension, QueryDsl, RunQueryDsl};
|
||||
use ldap3::{LdapConn, Scope, SearchEntry};
|
||||
|
@ -1161,6 +1163,19 @@ impl AsObject<User, Delete, &DbConn> for User {
|
|||
}
|
||||
}
|
||||
|
||||
impl AsObject07<User, Delete07, &DbConn> for User {
|
||||
type Error = Error;
|
||||
type Output = ();
|
||||
|
||||
fn activity07(self, conn: &DbConn, actor: User, _id: &str) -> Result<()> {
|
||||
if self.id == actor.id {
|
||||
self.delete(conn).map(|_| ())
|
||||
} else {
|
||||
Err(Error::Unauthorized)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Signer for User {
|
||||
fn get_key_id(&self) -> String {
|
||||
format!("{}#main-key", self.ap_url)
|
||||
|
|
Loading…
Reference in a new issue