Beispiel #1
0
 protected function readableCall()
 {
     $file_path = Path::getConfigDir() . '/endpoint-page.php';
     if (!file_exists($file_path)) {
         $file_path = Path::getLibDir() . '/endpoint-page.php';
     }
     include $file_path;
 }
Beispiel #2
0
 public static function login($user, $password)
 {
     $users = (require Path::getConfigDir() . '/passwd.php');
     if (!isset($users[$user])) {
         throw new AuthenticationError('Incorrect user credentials');
     }
     if (!password_verify($users[$user]['password'], $password)) {
         throw new AuthenticationError('Incorrect user credentials');
     }
     static::$user = new User($user, $users[$user]['groups']);
 }
 /**
  * discover all available services
  */
 public function discover()
 {
     $services = array();
     $service_list = (require Path::getConfigDir() . '/services.php');
     foreach ($service_list as $service_name => $service_options) {
         foreach ($service_options['groups'] as $group) {
             if (User::get()->isAuthorized($group)) {
                 $services[$service_name] = $service_options['description'];
                 break;
             }
         }
     }
     return $services;
 }