#3516641 Permissions in React app

#3516641

  • Permission check wrapper component
  • usePermissionCheck React hook
  • Permissions utility functions
    • Has permission
    • Has any permission
    • Has all permissions
  • Administer code components (xb.permissions.codeComponents)
    • Hide the "Add new" button
    • Hide “Code” accordion in the left sidebar
    • Hide all the items from the ellipsis menu on code components in the library. Ellipsis menu remains because ultimately all component sources will have an ellipsis menu with the “Insert” option in it.
    • Display warning when navigating directly to the code editor
  • Administer page templates (xb.permissions.globalRegions)
    • Hide “Move to global region” in contextual menu.
  • Administer sections (xb.permissions.sections)
    • Hide the “Create section” contextual menu
    • Hide the “Delete section” contextual menu
  • Create XB Page (Blocked on https://www.drupal.org/project/experience_builder/issues/3529895 landed)
    • Hide the "New page" button in the navigator component
  • Duplicate XB Page
    • Hide the "Duplicate page" contextual button on each page in the navigator
  • Administer Site Configuration
  • Delete XB Page
    • Hide the "Delete page" contextual button on each page in the navigator
  • Publish Experience Builder Content

I have also just added (not yet extensive) e2e tests for the following in Playwright:

  • "Create section" is hidden
  • "Add new" button for creating a new code component is hidden
  • Code accordion in the library is hidden
  • Move to global region is hidden
  • New page button in the navigator is hidden.
  • Publish all changes button is hidden

🚧 One test (for Duplicating pages via the XB navigator UI) is commented out in this MR pending https://www.drupal.org/project/experience_builder/issues/3533728

⚠️ Because the server does not send through the link for setting a page as Homepage, this MR landing will remove the "Set as Homepage" option from the navigator. I think this is ok because that option didn't actually work yet anyway and just showed a "todo"

Edited by Jesse Baker

Merge request reports

Loading