Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt

Use this file to discover all available pages before exploring further.

Date: 2026-01-26
Status: ✅ Complete
Component: ObjectPermissionsTab and related components

What Was Changed

1. Created New Hook ✅

  • File: src/platform/data-manager/hooks/useAvailableRoles.ts
  • Purpose: Fetch all available roles dynamically (18 system roles + custom roles)
  • Features:
    • Returns all system roles from app_role enum
    • Prepared for custom roles (when PF-26 supports them)
    • Provides getRoleLabel() and getRoleOrder() helpers

2. Updated ObjectPermissionsTab ✅

  • File: src/platform/data-manager/components/ObjectPermissionsTab.tsx
  • Changes:
    • Removed dependency on hardcoded ORDERED_ROLES (only had 5 roles)
    • Now uses useAvailableRoles() hook (shows all 18 system roles)
    • Dynamic role initialization from database
    • Updated deprecation notice to reflect completion

3. Updated ObjectPermissionMatrix ✅

  • File: src/platform/data-manager/components/ObjectPermissionMatrix.tsx
  • Changes:
    • Removed ROLE_CONFIG import
    • Uses roleLabel from props (set by parent component)
    • Removed sorting logic (parent handles ordering)

4. Updated FieldPermissionsSection ✅

  • File: src/platform/data-manager/components/FieldPermissionsSection.tsx
  • Changes:
    • Removed ORDERED_ROLES and ROLE_CONFIG imports
    • Uses useAvailableRoles() hook
    • Uses getRoleLabel() helper for display names

5. Updated Type Definitions ✅

  • File: src/platform/data-manager/types/permissions.ts
  • Changes:
    • Added deprecation notices to ORDERED_ROLES and ROLE_CONFIG
    • Marked for removal after 2026-03-31
    • Kept for backward compatibility during transition

Benefits

  1. Complete Role Coverage: Now shows all 18 system roles instead of just 5
  2. Dynamic: Role list is database-driven, not hardcoded
  3. Future-Ready: Prepared for custom roles when PF-26 supports them
  4. Consistent: Uses same role fetching pattern as rest of V2 system
  5. Maintainable: No more hardcoded role lists to update

Breaking Changes

None - This is a non-breaking enhancement:
  • Existing permissions in database remain valid
  • Component API unchanged
  • All existing functionality preserved
  • Only adds more roles to the UI

Testing Required

Before considering migration complete:
  • Verify all 18 system roles appear in permission matrix
  • Verify role ordering is correct
  • Verify permissions can be saved for all roles
  • Verify existing permissions load correctly
  • Verify field permissions work with all roles
  • Verify site scope configuration works
  • Test with organizations that have custom roles (when supported)

Next Steps

  1. Testing: Run comprehensive tests on ObjectPermissionsTab
  2. Documentation: Update user guides if needed
  3. Cleanup (After 2026-03-31): Remove deprecated ORDERED_ROLES and ROLE_CONFIG constants

Files Modified

  • src/platform/data-manager/hooks/useAvailableRoles.ts (new)
  • src/platform/data-manager/components/ObjectPermissionsTab.tsx
  • src/platform/data-manager/components/ObjectPermissionMatrix.tsx
  • src/platform/data-manager/components/FieldPermissionsSection.tsx
  • src/platform/data-manager/types/permissions.ts
  • docs/platform/data-manager/OBJECT_PERMISSIONS_V2_MIGRATION.md (new)

See Also