mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-01 02:46:04 +01:00
Fix #943 allow non admin.super users to change their account information. Allow admin.super and admin.users to change other users information.
This commit is contained in:
@@ -438,6 +438,18 @@ class AdminController extends AdminBaseController
|
||||
|
||||
$config = $this->grav['config'];
|
||||
|
||||
// Special handler for user data.
|
||||
if ($this->view == 'user') {
|
||||
if (!$this->admin->authorize(['admin.super', 'admin.users'])) {
|
||||
//not admin.super or admin.users
|
||||
if ($this->prepareData($data)->username !== $this->grav['user']->username) {
|
||||
$this->admin->setMessage($this->admin->translate('PLUGIN_ADMIN.INSUFFICIENT_PERMISSIONS_FOR_TASK') . ' save.',
|
||||
'error');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Special handler for pages data.
|
||||
if ($this->view == 'pages') {
|
||||
/** @var Pages $pages */
|
||||
@@ -512,7 +524,6 @@ class AdminController extends AdminBaseController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
// Handle standard data types.
|
||||
$obj = $this->prepareData($data);
|
||||
|
||||
Reference in New Issue
Block a user