feat(pbac): add FeatureOptIn resource to permission registry (#26761)

* feat(pbac): add Feature resource to permission registry

Co-Authored-By: [email protected] <[email protected]>

* feat(pbac): add migration for Feature resource permissions

Co-Authored-By: [email protected] <[email protected]>

* feat(pbac): add English translations for Feature resource

Co-Authored-By: [email protected] <[email protected]>

* feat(pbac): update Feature resource for opt-in/opt-out control (read and update only)

Co-Authored-By: [email protected] <[email protected]>

* feat(pbac): rename Feature to FeatureOptIn resource

Co-Authored-By: [email protected] <[email protected]>

* feat(pbac): simplify update description text

Co-Authored-By: [email protected] <[email protected]>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Eunjae LeeandDevin AI authored and GitHub committed 2026-01-13 10:17:41 +00:00
1 parent fd6e2a9ca5
commit 829d6c4714
3 files changed
+42 -2

No files matched your search

@@ -13,6 +13,7 @@ export enum Resource {
Availability = "availability",
OutOfOffice = "ooo",
Watchlist = "watchlist",
FeatureOptIn = "featureOptIn",
}
export enum CrudAction {
@@ -768,4 +769,22 @@ export const PERMISSION_REGISTRY: PermissionRegistry = {
dependsOn: ["watchlist.read"],
},
},
[Resource.FeatureOptIn]: {
_resource: {
i18nKey: "pbac_resource_feature_opt_in",
},
[CrudAction.Read]: {
description: "View feature opt-in settings",
category: "featureOptIn",
i18nKey: "pbac_action_read",
descriptionI18nKey: "pbac_desc_view_feature_opt_in",
},
[CrudAction.Update]: {
description: "Manage feature opt-in settings",
category: "featureOptIn",
i18nKey: "pbac_action_update",
descriptionI18nKey: "pbac_desc_update_feature_opt_in",
dependsOn: ["featureOptIn.read"],
},
},
};
@@ -0,0 +1,18 @@
INSERT INTO "RolePermission" (id, "roleId", resource, action, "createdAt")
SELECT
gen_random_uuid(), 'admin_role', resource, action, NOW()
FROM (
VALUES
('featureOptIn', 'read'),
('featureOptIn', 'update')
) AS permissions(resource, action)
ON CONFLICT ("roleId", resource, action) DO NOTHING;
INSERT INTO "RolePermission" (id, "roleId", resource, action, "createdAt")
SELECT
gen_random_uuid(), 'member_role', resource, action, NOW()
FROM (
VALUES
('featureOptIn', 'read')
) AS permissions(resource, action)
ON CONFLICT ("roleId", resource, action) DO NOTHING;