public function __construct(Application $app, $module, $action) { parent::__construct($app, $module, $action); if ($this->app->user()->getAttribute('user')->level() != MemberManager::ADMINISTRATOR) { $this->app->httpResponse()->redirect('/admin/'); } $this->page->addVar('router', new Router()); }
public function __construct(Application $app, $module, $action) { parent::__construct($app, $module, $action); $this->page->addVar('router', new Router()); $Member = $this->app->user()->getAttribute('user'); if (!$this->app->httpRequest()->getExists('id')) { return; } $news_id = $this->app->httpRequest()->getData('id'); $ManagerNews = $this->managers->getmanagerof('news'); $News = $ManagerNews->getUnique($news_id); if (!$News) { $this->app->user()->setFlash('La news spécifiée n\'existe pas'); $this->app->httpResponse()->redirect('/admin/'); } if (($action == "update" || $action == "delete") && $Member->level() != MemberManager::ADMINISTRATOR) { $ManagerNews = $this->managers->getmanagerof('news'); if ($Member->id() != $ManagerNews->getUnique($news_id)->auteurId()) { $this->app->user()->setFlash("Vous n'avez les droits nécessaires pour cette action !"); $this->app->httpResponse()->redirect('/admin/'); } } }
public function __construct(Application $app, $module, $action) { parent::__construct($app, $module, $action); $this->page->addVar('router', new Router()); }