fix: [ACL] proper error messages on user edit
- don't just silently redirect to the own user editing if the user isn't authorised to modify another userpull/92/head
parent
87723c2100
commit
caf48c9060
|
@ -97,8 +97,16 @@ class UsersController extends AppController
|
|||
public function edit($id = false)
|
||||
{
|
||||
$currentUser = $this->ACL->getUser();
|
||||
if (empty($id) || (empty($currentUser['role']['perm_org_admin']) && empty($currentUser['role']['perm_admin']))) {
|
||||
if (empty($id)) {
|
||||
$id = $currentUser['id'];
|
||||
} else {
|
||||
if ((empty($currentUser['role']['perm_org_admin']) && empty($currentUser['role']['perm_admin']))) {
|
||||
if ($id !== $currentUser['id']) {
|
||||
throw new MethodNotAllowedException(__('You are not authorised to edit that user.'));
|
||||
} else {
|
||||
$id = $currentUser['id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$params = [
|
||||
|
|
Loading…
Reference in New Issue