Overview
The following permissions determine access to high-level features in the XB UI, and will allow the UI to perform a simple if (boolean) { show(); }-style check:
- Administer Page Template (for
PageRegion config entities, which together make up the "page template") → show the Move to global region option in context menus … or not
- Administer Sections (for
Pattern config entities) → show "Create section" in context menus … or not (⚠️ list of sections to use is always available!)
- Administer Code Components (for
JavaScriptComponent and AssetLibrary config entities) → show "Add component" and "Code" in sidebar + request /xb/api/js_component … or not
Partially blocked on #3508694: Permissions for XB config entity types, because Pattern doesn't yet have the appropriate permission.
Proposed resolution
diff --git a/src/Controller/ExperienceBuilderController.php b/src/Controller/ExperienceBuilderController.php
index 94dfed312..f1878b80f 100644
@@ -110,6 +111,11 @@ HTML;
'jsFooter' => $this->assetRenderer->renderJsFooterAssets($preview_assets),
],
'xbModulePath' => $xb_module_path,
+ 'permissions' => [
+ 'globalRegion' => $this->currentUser->hasPermission(PageRegion::ADMIN_PERMISSION),
+ 'sections' => $this->currentUser->hasPermission(Pattern::ADMIN_PERMISSION),
+ 'codeComponents' => $this->currentUser->hasPermission(JavaScriptComponent::ADMIN_PERMISSION),
+ ],
],
],
// Note: the tokens here are under our control, and this accepts no user
User interface changes
None; that's for #3516641: Make the XB UI show only UI elements/operations available to the current user and related issues to tackle.
Comments
Comment #2
wim leersComment #3
wim leersComment #6
penyaskitoMR on top of #3508694: Permissions for XB config entity types.
The actual thing to review here is since 2696a5.
Comment #7
wim leersComment #8
wim leers#3508694: Permissions for XB config entity types is in, this now needs a reroll :)
Comment #9
penyaskitoComment #10
wim leers🏓
Comment #12
penyaskitoComment #13
wim leersOne last tiny thing and then this will be able to land! 🚀
Comment #14
penyaskito🏓
Comment #15
wim leersComment #17
wim leersComment #18
nagwani commented