Example #1
0
 public function getNewUser()
 {
     $userName = $this->getUserName();
     $password = $this->getPassword();
     if ($userName !== "" && $password !== "") {
         $user = new \auth\model\User();
         $user->setUserName($userName);
         $user->setPassword($password);
         $user->setIsAdmin($this->getIsAdmin());
         return $user;
     } else {
         $this->setErrorVar();
     }
     return null;
 }
 public function getAllUsers()
 {
     $sql = "SELECT * FROM " . $this->table;
     $ret = array();
     if ($response = $this->query($sql)) {
         foreach ($response as $userDbo) {
             $user = new \auth\model\User($userDbo['id']);
             $user->setPasswordHash($userDbo['password_hash']);
             $user->setUserName($userDbo['user_name']);
             $user->setIsAdmin($userDbo['is_admin']);
             $ret[] = $user;
         }
     }
     return $ret;
 }