mirror of
https://github.com/processwire/processwire.git
synced 2025-08-09 16:26:59 +02:00
Add PR #261 - Added page-edit-redirects optional permission
This commit is contained in:
committed by
Ryan Cramer
parent
fb980f24c7
commit
dafceffc6f
@@ -180,6 +180,10 @@ class Permissions extends PagesType {
|
||||
if($role->name === 'superuser') continue;
|
||||
$a["user-admin-$role->name"] = sprintf($this->_('Administer users in role: %s'), $role->name);
|
||||
}
|
||||
|
||||
if($this->wire()->modules->isInstalled('PagePathHistory')) {
|
||||
$a['page-edit-redirects'] = $this->_('User can add/edit/delete redirect URLs in the page editor');
|
||||
}
|
||||
|
||||
$languages = $this->wire()->languages;
|
||||
if($languages) {
|
||||
|
@@ -1267,8 +1267,9 @@ class ProcessPageEdit extends Process implements WirePageEditor, ConfigurableMod
|
||||
*
|
||||
*/
|
||||
protected function ___buildFormSettings() {
|
||||
|
||||
$superuser = $this->wire('user')->isSuperuser();
|
||||
|
||||
$user = $this->wire()->user;
|
||||
$superuser = $user->isSuperuser();
|
||||
|
||||
/** @var InputfieldWrapper $wrapper */
|
||||
$wrapper = $this->wire(new InputfieldWrapper());
|
||||
@@ -1308,7 +1309,7 @@ class ProcessPageEdit extends Process implements WirePageEditor, ConfigurableMod
|
||||
}
|
||||
|
||||
// page path history (previous URLs)
|
||||
if($superuser) {
|
||||
if($superuser || $user->hasPermission('page-edit-redirects', $this->page)) {
|
||||
$f = $this->buildFormPrevPaths();
|
||||
if($f) $wrapper->add($f);
|
||||
}
|
||||
|
Reference in New Issue
Block a user