Skip to content

Commit

Permalink
docs(changeset): Webhook permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
robjmorrissey committed Oct 2, 2023
1 parent 85fbbe3 commit cfb6a43
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/heavy-olives-explain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@onehop/js': minor
---

Webhook permissions
22 changes: 19 additions & 3 deletions src/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ export enum PROJECT_PERMISSION {
DELETE_REGISTRY_IMAGES = 'delete_registry_images',
CONTAINER_SSH = 'container_ssh',
TUNNEL_DEPLOYMENT = 'tunnel_deployment',
CREATE_WEBHOOK = 'create_webhook',
DELETE_WEBHOOK = 'delete_webhook',
UPDATE_WEBHOOK = 'update_webhook',
READ_WEBHOOKS = 'read_webhooks',
}

/**
Expand Down Expand Up @@ -102,6 +106,10 @@ export const permissionsMap = {
[PROJECT_PERMISSION.DELETE_REGISTRY_IMAGES]: 1n << 44n,
[PROJECT_PERMISSION.CONTAINER_SSH]: 1n << 45n,
[PROJECT_PERMISSION.TUNNEL_DEPLOYMENT]: 1n << 46n,
[PROJECT_PERMISSION.CREATE_WEBHOOK]: 1n << 47n,
[PROJECT_PERMISSION.DELETE_WEBHOOK]: 1n << 48n,
[PROJECT_PERMISSION.UPDATE_WEBHOOK]: 1n << 49n,
[PROJECT_PERMISSION.READ_WEBHOOKS]: 1n << 50n,
};

/**
Expand Down Expand Up @@ -170,6 +178,11 @@ export const BROAD_PERMISSIONS_MAP = {
MANAGE_QUOTAS: permissionsMap.request_quota_increase,
MANAGE_ROLLOUTS: permissionsMap.rollout,
MANAGE_BILLING: permissionsMap.read_billing,
MANAGE_WEBHOOKS:
permissionsMap.create_webhook |
permissionsMap.delete_webhook |
permissionsMap.update_webhook |
permissionsMap.read_webhooks,
};

/**
Expand All @@ -184,7 +197,8 @@ export const roles = {
BROAD_PERMISSIONS_MAP.MANAGE_PIPE |
BROAD_PERMISSIONS_MAP.MANAGE_SECRETS |
BROAD_PERMISSIONS_MAP.MANAGE_REGISTRY |
BROAD_PERMISSIONS_MAP.READ_ONLY,
BROAD_PERMISSIONS_MAP.READ_ONLY |
BROAD_PERMISSIONS_MAP.MANAGE_WEBHOOKS,
admin:
BROAD_PERMISSIONS_MAP.MANAGE_CHANNELS |
BROAD_PERMISSIONS_MAP.MANAGE_DEPLOYMENTS |
Expand All @@ -194,7 +208,8 @@ export const roles = {
BROAD_PERMISSIONS_MAP.MANAGE_SECRETS |
BROAD_PERMISSIONS_MAP.MANAGE_REGISTRY |
BROAD_PERMISSIONS_MAP.MANAGE_QUOTAS |
BROAD_PERMISSIONS_MAP.READ_ONLY,
BROAD_PERMISSIONS_MAP.READ_ONLY |
BROAD_PERMISSIONS_MAP.MANAGE_WEBHOOKS,
owner:
BROAD_PERMISSIONS_MAP.MANAGE_CHANNELS |
BROAD_PERMISSIONS_MAP.MANAGE_DEPLOYMENTS |
Expand All @@ -205,7 +220,8 @@ export const roles = {
BROAD_PERMISSIONS_MAP.MANAGE_REGISTRY |
BROAD_PERMISSIONS_MAP.MANAGE_QUOTAS |
BROAD_PERMISSIONS_MAP.MANAGE_ROLLOUTS |
BROAD_PERMISSIONS_MAP.MANAGE_BILLING,
BROAD_PERMISSIONS_MAP.MANAGE_BILLING |
BROAD_PERMISSIONS_MAP.MANAGE_WEBHOOKS,
};

/**
Expand Down

0 comments on commit cfb6a43

Please sign in to comment.