From 355f840e4042bfbc21a8bf15ef599b07390b74a9 Mon Sep 17 00:00:00 2001 From: Jason Coward Date: Thu, 15 Feb 2024 14:15:26 -0700 Subject: [PATCH] Fix visibility of modResource derivatives in context menus and combos (#16403) Update modResource derivatives Ensure correct visibility of context menu items and combo options based on user permissions to create Symlinks, Weblinks, and/or Static Resources --- core/src/Revolution/modStaticResource.php | 4 +++- core/src/Revolution/modSymLink.php | 4 +++- core/src/Revolution/modWebLink.php | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/core/src/Revolution/modStaticResource.php b/core/src/Revolution/modStaticResource.php index 553c39ec371..ac8bfc73418 100644 --- a/core/src/Revolution/modStaticResource.php +++ b/core/src/Revolution/modStaticResource.php @@ -27,7 +27,9 @@ public function __construct(xPDO $xpdo) { parent:: __construct($xpdo); $this->set('class_key', __CLASS__); - $this->showInContextMenu = true; + $canCreate = (bool)$this->xpdo->hasPermission('new_static_resource'); + $this->allowListingInClassKeyDropdown = $canCreate; + $this->showInContextMenu = $canCreate; } /** diff --git a/core/src/Revolution/modSymLink.php b/core/src/Revolution/modSymLink.php index e3e558187c0..5e40fbe247d 100644 --- a/core/src/Revolution/modSymLink.php +++ b/core/src/Revolution/modSymLink.php @@ -20,7 +20,9 @@ public function __construct(xPDO $xpdo) parent:: __construct($xpdo); $this->set('type', 'reference'); $this->set('class_key', __CLASS__); - $this->showInContextMenu = true; + $canCreate = (bool)$this->xpdo->hasPermission('new_symlink'); + $this->allowListingInClassKeyDropdown = $canCreate; + $this->showInContextMenu = $canCreate; } /** diff --git a/core/src/Revolution/modWebLink.php b/core/src/Revolution/modWebLink.php index 884fcbb60bf..ed699169781 100644 --- a/core/src/Revolution/modWebLink.php +++ b/core/src/Revolution/modWebLink.php @@ -20,7 +20,9 @@ public function __construct(xPDO $xpdo) parent:: __construct($xpdo); $this->set('type', 'reference'); $this->set('class_key', __CLASS__); - $this->showInContextMenu = true; + $canCreate = (bool)$this->xpdo->hasPermission('new_weblink'); + $this->allowListingInClassKeyDropdown = $canCreate; + $this->showInContextMenu = $canCreate; } /**