Skip to content

Commit d5142c7

Browse files
committed
Re-name permissions to match domain type requirements
1 parent 626fe11 commit d5142c7

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

sql/2025-04-09_notifications.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,5 +270,5 @@ CREATE TRIGGER notification_event_subscriptions
270270

271271
-- Add new permissions to existing roles
272272
UPDATE roles r
273-
SET permissions = r.permissions || '{"notification:hub_entry:view", "notification:hub_entry:update", "notification:delivery_method:view", "notification:delivery_method:manage", "notification:subscription:view", "notification:subscription:manage"}'
273+
SET permissions = r.permissions || '{"notification_hub_entry:view", "notification_hub_entry:update", "notification_delivery_method:view", "notification_delivery_method:manage", "notification_subscription:view", "notification_subscription:manage"}'
274274
WHERE r.ref IN ('org_admin'::role_ref, 'org_owner'::role_ref, 'org_default'::role_ref, 'org_maintainer'::role_ref);

src/Share/Web/Authorization/Types.hs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,12 @@ rolePermissionToText = \case
185185
OrgProjectCreate -> "org:create_project"
186186
TeamView -> "team:view"
187187
TeamManage -> "team:manage"
188-
NotificationHubEntryView -> "notification:hub_entry:view"
189-
NotificationHubEntryUpdate -> "notification:hub_entry:update"
190-
NotificationSubscriptionView -> "notification:subscription:view"
191-
NotificationSubscriptionManage -> "notification:subscription:manage"
192-
NotificationDeliveryMethodView -> "notification:delivery_method:view"
193-
NotificationDeliveryMethodManage -> "notification:delivery_method:manage"
188+
NotificationHubEntryView -> "notification_hub_entry:view"
189+
NotificationHubEntryUpdate -> "notification_hub_entry:update"
190+
NotificationSubscriptionView -> "notification_subscription:view"
191+
NotificationSubscriptionManage -> "notification_subscription:manage"
192+
NotificationDeliveryMethodView -> "notification_delivery_method:view"
193+
NotificationDeliveryMethodManage -> "notification_delivery_method:manage"
194194

195195
rolePermissionFromText :: Text -> Maybe RolePermission
196196
rolePermissionFromText = \case
@@ -209,6 +209,12 @@ rolePermissionFromText = \case
209209
"org:create_project" -> Just OrgProjectCreate
210210
"team:view" -> Just TeamView
211211
"team:manage" -> Just TeamManage
212+
"notification_hub_entry:view" -> Just NotificationHubEntryView
213+
"notification_hub_entry:update" -> Just NotificationHubEntryUpdate
214+
"notification_subscription:view" -> Just NotificationSubscriptionView
215+
"notification_subscription:manage" -> Just NotificationSubscriptionManage
216+
"notification_delivery_method:view" -> Just NotificationDeliveryMethodView
217+
"notification_delivery_method:manage" -> Just NotificationDeliveryMethodManage
212218
_ -> Nothing
213219

214220
instance Hasql.EncodeValue RolePermission where

0 commit comments

Comments
 (0)