Ejemplo n.º 1
0
 /**
  * Initialize the authentication, picking up on session data if possible.
  *
  * @return bool
  */
 public function initialize()
 {
     if ($this->checkAuthentication()) {
         $data = $this->getAuthenticationData();
         $userId = $data['user_id'];
         $user = $this->toolkit->getRepository(\Model\User::class)->getById($userId);
         if (!$user) {
             $this->setAuthenticated(false);
             $this->setAuthenticationData([]);
             return false;
         }
         $this->setUser($user);
         return true;
     }
     return false;
 }
Ejemplo n.º 2
0
 /**
  * Magic get function to pass through all calls to DI-able classes.
  *
  * @param string $property
  *
  * @return null|object
  */
 public function __get($property)
 {
     $mappedProperty = $this->toolkit->getResourceMapping(ucfirst($property));
     if ($mappedProperty) {
         return \Parable\DI\Container::get($mappedProperty);
     }
     return null;
 }