Skip to content

Commit

Permalink
The Workflow control panel menu item now will only show if the user h…
Browse files Browse the repository at this point in the history
…as “Overview” permission
  • Loading branch information
engram-design committed Nov 21, 2023
1 parent 4e9d34d commit 1088f56
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Workflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class Workflow extends Plugin
// Properties
// =========================================================================

public bool $hasCpSection = true;
public bool $hasCpSettings = true;
public string $schemaVersion = '2.5.0';
public string $minVersionRequired = '1.7.0';
Expand Down Expand Up @@ -73,6 +72,13 @@ public function init(): void
if (Craft::$app->getRequest()->getIsCpRequest()) {
$this->_registerCpRoutes();
$this->_registerWidgets();

// Only show the menu item if user has permission to overview
if ($currentUser = Craft::$app->getUser()->getIdentity()) {
if ($currentUser->can('workflow-overview')) {
$this->hasCpSection = true;
}
}
}

if (Craft::$app->getRequest()->getIsConsoleRequest()) {
Expand Down

0 comments on commit 1088f56

Please sign in to comment.