Enable superusers to actually use the is_superuser filter

This commit is contained in:
Luke Towers 2017-10-14 21:55:56 -06:00
parent fa840d79f6
commit f739e457e4

View File

@ -49,10 +49,13 @@ class Users extends Controller
*/
public function __construct()
{
// 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']);
$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();