mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-10-29 09:16:48 +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:
@@ -6,6 +6,7 @@
|
||||
* Allow to see plugins and themes list without internet connection. Also add a more helpful message in the "add" view [grav#1008](https://github.com/getgrav/grav/issues/1008)
|
||||
1. [](#bugfix)
|
||||
* Fixed issue with downloaded package when installing a testing release
|
||||
* Fix #943 allow non admin.super users to change their account information. Allow `admin.super` and `admin.users` to change other users information.
|
||||
|
||||
# v1.2.9
|
||||
## 01/18/2017
|
||||
|
||||
@@ -437,6 +437,10 @@ class AdminBaseController
|
||||
case 'users':
|
||||
$permissions[] = 'admin.users';
|
||||
break;
|
||||
case 'user':
|
||||
$permissions[] = 'admin.login';
|
||||
$permissions[] = 'admin.users';
|
||||
break;
|
||||
case 'pages':
|
||||
$permissions[] = 'admin.pages';
|
||||
break;
|
||||
|
||||
@@ -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