Ejemplo n.º 1
0
 public function _onload()
 {
     parent::_onload();
     if (!$this->isAdmin) {
         throw new \spitfire\exceptions\PrivateException('You cannot acces this section without being an admin', 403);
     }
 }
Ejemplo n.º 2
0
 public function _onload()
 {
     parent::_onload();
     #All of the functions this method provides are restricted to administrators.
     if (!$this->isAdmin) {
         throw new PublicException('Not allowed. PLease log in using a admin account', 403);
     }
 }
Ejemplo n.º 3
0
 public function _onload()
 {
     parent::_onload();
     #Get the user model
     if (!$this->user) {
         throw new PublicException('Not logged in', 403);
     }
     #Check if he's an admin
     if (!$this->isAdmin) {
         throw new PublicException('Not an admin', 401);
     }
 }