Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
♻️ Add webhook scopes to API key
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Nov 7, 2020
1 parent 47869cd commit 74705d6
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/modules/api-keys/api-keys.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,23 @@ export class ApiKeysService {
] = `Delete API key: ${apiKey.name ?? apiKey.apiKey}`;
}

scopes[`group-${groupId}:write-webhook-*`] = 'Create and update webhooks';
scopes[`group-${groupId}:read-webhook-*`] = 'Read webhooks';
for await (const webhook of await this.prisma.webhooks.findMany({
where: { group: { id: groupId } },
select: { id: true, url: true },
})) {
scopes[
`group-${groupId}:read-webhook-${webhook.id}`
] = `Read webhook: ${webhook.url}`;
scopes[
`group-${groupId}:write-webhook-${webhook.id}`
] = `Write webhook: ${webhook.url}`;
scopes[
`group-${groupId}:delete-webhook-${webhook.id}`
] = `Delete webhook: ${webhook.url}`;
}

scopes[`group-${groupId}:write-billing`] = 'Write billing details';
scopes[`group-${groupId}:read-billing`] = 'Read billing details';
scopes[`group-${groupId}:delete-billing`] = 'Delete billing details';
Expand Down

0 comments on commit 74705d6

Please sign in to comment.