diff options
author | Stefan Melmuk <[email protected]> | 2024-05-19 20:33:00 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2024-05-19 20:33:00 +0200 |
commit | f5fb69b64f81dbec80debb1cf59115af4ab3372c (patch) | |
tree | 610cad6c843534227e385513e5f5e8f60656d37a /src | |
parent | 3261534438f572a36029f17f9a0ce88fe2b79b0d (diff) | |
download | vaultwarden-f5fb69b64f81dbec80debb1cf59115af4ab3372c.tar.gz vaultwarden-f5fb69b64f81dbec80debb1cf59115af4ab3372c.zip |
also delete organization_api_key (#4557)
Diffstat (limited to 'src')
-rw-r--r-- | src/db/models/organization.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/db/models/organization.rs b/src/db/models/organization.rs index 59d66856..73088650 100644 --- a/src/db/models/organization.rs +++ b/src/db/models/organization.rs @@ -316,6 +316,7 @@ impl Organization { UserOrganization::delete_all_by_organization(&self.uuid, conn).await?; OrgPolicy::delete_all_by_organization(&self.uuid, conn).await?; Group::delete_all_by_organization(&self.uuid, conn).await?; + OrganizationApiKey::delete_all_by_organization(&self.uuid, conn).await?; db_run! { conn: { diesel::delete(organizations::table.filter(organizations::uuid.eq(self.uuid))) @@ -886,6 +887,14 @@ impl OrganizationApiKey { .ok().from_db() }} } + + pub async fn delete_all_by_organization(org_uuid: &str, conn: &mut DbConn) -> EmptyResult { + db_run! { conn: { + diesel::delete(organization_api_key::table.filter(organization_api_key::org_uuid.eq(org_uuid))) + .execute(conn) + .map_res("Error removing organization api key from organization") + }} + } } #[cfg(test)] |