Fixes #3315
Fixes #3315 by moving the manipulation of the filter widget scopes to the controller event method instead of before any part of the controller constructor method is run.
This commit is contained in:
parent
7ffb79a5fd
commit
69e56b0b5b
|
|
@ -49,14 +49,6 @@ class Users extends Controller
|
|||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->user = BackendAuth::getUser();
|
||||
if (!$this->user->isSuperUser()) {
|
||||
// Prevent non-superusers from even seeing the is_superuser filter
|
||||
$this->listConfig = $this->makeConfig($this->listConfig);
|
||||
$this->listConfig->filter = $this->makeConfig($this->listConfig->filter);
|
||||
unset($this->listConfig->filter->scopes['is_superuser']);
|
||||
}
|
||||
|
||||
parent::__construct();
|
||||
|
||||
if ($this->action == 'myaccount') {
|
||||
|
|
@ -76,6 +68,16 @@ class Users extends Controller
|
|||
$query->where('is_superuser', false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevents non-superusers from even seeing the is_superuser filter
|
||||
*/
|
||||
public function listFilterExtendScopes($filterWidget)
|
||||
{
|
||||
if (!$this->user->isSuperUser()) {
|
||||
$filterWidget->removeScope('is_superuser');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Extends the form query to prevent non-superusers from accessing superusers at all
|
||||
|
|
|
|||
Loading…
Reference in New Issue