diff --git a/.changeset/heavy-olives-explain.md b/.changeset/heavy-olives-explain.md new file mode 100644 index 00000000..1b80d360 --- /dev/null +++ b/.changeset/heavy-olives-explain.md @@ -0,0 +1,5 @@ +--- +'@onehop/js': minor +--- + +Webhook permissions diff --git a/src/permissions.ts b/src/permissions.ts index 351bb194..5ebffb04 100644 --- a/src/permissions.ts +++ b/src/permissions.ts @@ -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', } /** @@ -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, }; /** @@ -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, }; /** @@ -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 | @@ -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 | @@ -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, }; /**