Skip to content

Commit

Permalink
delete tenants and roles from OpenDistro
Browse files Browse the repository at this point in the history
  • Loading branch information
Toby Bellwood committed Jul 21, 2021
1 parent 70abc73 commit d7eeb3e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion services/api/src/resources/group/opendistroSecurity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ export const OpendistroSecurityOperations = (
}
},
deleteGroup: async function(groupName) {
await this.deleteGroupWithSpecificTenant(groupName, groupName);
},
deleteGroupWithSpecificTenant: async function(groupName, tenantName) {
// delete groups that have no Projects assigned to them
try {
await opendistroSecurityClient.delete(`roles/${groupName}`);
Expand All @@ -234,6 +237,6 @@ export const OpendistroSecurityOperations = (
}
}

await this.deleteTenant(groupName);
await this.deleteTenant(tenantName);
}
});
3 changes: 2 additions & 1 deletion services/api/src/resources/project/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,8 @@ export const deleteProject: ResolverFn = async (
`project-${project.name}`
);
await models.GroupModel.deleteGroup(group.id);
OpendistroSecurityOperations(sqlClientPool, models.GroupModel).deleteGroup(
OpendistroSecurityOperations(sqlClientPool, models.GroupModel).deleteGroupWithSpecificTenant(
`p${pid}`,
group.name
);
} catch (err) {
Expand Down

0 comments on commit d7eeb3e

Please sign in to comment.