diff --git a/modules/backend/classes/Controller.php b/modules/backend/classes/Controller.php index 7553aacec..b8c82c176 100644 --- a/modules/backend/classes/Controller.php +++ b/modules/backend/classes/Controller.php @@ -148,12 +148,21 @@ class Controller extends Extendable $this->layoutPath[] = '~/modules/' . $relativePath . '/layouts'; $this->layoutPath[] = '~/plugins/' . $relativePath . '/layouts'; + /* + * Create a new instance of the admin user + */ + $this->user = BackendAuth::getUser(); + parent::__construct(); /* * Media Manager widget is available on all back-end pages */ - if (class_exists('Cms\Widgets\MediaManager')) { + if ( + class_exists('Cms\Widgets\MediaManager') && + $this->user && + $this->user->hasAccess('media.*') + ) { $manager = new MediaManager($this, 'ocmediamanager'); $manager->bindToController(); } @@ -196,9 +205,6 @@ class Controller extends Extendable */ $isPublicAction = in_array($action, $this->publicActions); - // Create a new instance of the admin user - $this->user = BackendAuth::getUser(); - /* * Check that user is logged in and has permission to view this page */