mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-07-28 14:49:09 +00:00
Implement deleting Organization
This commit is contained in:
parent
726ba36e5b
commit
941747f9e8
4 changed files with 71 additions and 22 deletions
|
@ -62,6 +62,13 @@ impl Collection {
|
|||
).execute(&**conn).and(Ok(()))
|
||||
}
|
||||
|
||||
pub fn delete_all_by_organization(org_uuid: &str, conn: &DbConn) -> QueryResult<()> {
|
||||
for collection in Self::find_by_organization(org_uuid, &conn) {
|
||||
collection.delete(&conn)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn find_by_uuid(uuid: &str, conn: &DbConn) -> Option<Self> {
|
||||
collections::table
|
||||
.filter(collections::uuid.eq(uuid))
|
||||
|
@ -176,6 +183,12 @@ impl CollectionUser {
|
|||
.filter(users_collections::collection_uuid.eq(collection_uuid))
|
||||
).execute(&**conn).and(Ok(()))
|
||||
}
|
||||
|
||||
pub fn delete_all_by_user(user_uuid: &str, conn: &DbConn) -> QueryResult<()> {
|
||||
diesel::delete(users_collections::table
|
||||
.filter(users_collections::user_uuid.eq(user_uuid))
|
||||
).execute(&**conn).and(Ok(()))
|
||||
}
|
||||
}
|
||||
|
||||
use super::Cipher;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue