Skip to content

Commit

Permalink
Only show resource types in template picker and context menus if the …
Browse files Browse the repository at this point in the history
…user has permission to create them (#15893)

Merge remote-tracking branch 'upstream/pr/16403' into 3.x

* upstream/pr/16403:
  Update modResource derivatives
  • Loading branch information
Mark-H committed Feb 10, 2024
2 parents 8c35dbf + 20ae2a6 commit bca1927
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions core/docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ development release, and is only shown to give an idea of what's currently in th
- Grid filtering via URL parameters added to most grids in the manager (#16089, #16369)
- Store last opened media browser path in browser history / URL parameters to re-open last path (#16394)
- Fix template picker to avoid errors in certain edge cases (#16400)
- Only show resource types in template picker and context menus if the user has permission to create them (#15893)

MODX Revolution 3.0.3-pl (January 17, 2023)
====================================
Expand Down
4 changes: 3 additions & 1 deletion core/src/Revolution/modStaticResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion core/src/Revolution/modSymLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion core/src/Revolution/modWebLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion manager/assets/modext/modx.jsgrps-min.js

Large diffs are not rendered by default.

0 comments on commit bca1927

Please sign in to comment.