Exemplo n.º 1
0
 public function post(\Request $request)
 {
     $settingsFactory = new SettingsFactory();
     $vars = $request->getRequestVars();
     $data['command'] = $command = $request->shiftCommand();
     $isJson = false;
     switch ($command) {
         case 'editPermissions':
             $result = $settingsFactory->savePermissions($request);
             break;
         case 'editDepartments':
             $result = $settingsFactory->saveDepartment($request);
             $isJson = true;
             break;
         case 'editLocations':
             $result = $settingsFactory->saveLocation($request);
             $isJson = true;
             break;
         default:
             throw new Exception("Invalid command received in system settings. Command = {$command}");
     }
     //        $device_id = $sdfactory->postDevice($request);
     //
     //        $this->postSpecificDevice($request, $device_type, $device_id);
     //
     //        $data['action'] = 'success';
     if ($isJson) {
         $view = new \View\JsonView(array('success' => TRUE));
     } else {
         $view = $this->getHtmlView($data, $request);
     }
     $response = new \Response($view);
     return $response;
 }
Exemplo n.º 2
0
 public function post(\Request $request)
 {
     include_once PHPWS_SOURCE_DIR . "mod/systemsinventory/config/device_types.php";
     $sdfactory = new SDFactory();
     $vars = $request->getRequestVars();
     $isJSON = false;
     $data['command'] = $request->shiftCommand();
     if (!empty($vars['device_id']) && empty($vars['profile_name'])) {
         $isJSON = true;
     }
     $device_type = PC;
     if (isset($vars['server'])) {
         $device_type = SERVER;
     } elseif (isset($vars['device_type'])) {
         $device_type = $vars['device_type'];
     }
     $device_id = $sdfactory->postDevice($request);
     $this->postSpecificDevice($request, $device_type, $device_id);
     $data['action'] = 'success';
     if ($isJSON) {
         $view = new \View\JsonView(array('success' => TRUE));
     } else {
         $view = $this->getHtmlView($data, $request);
     }
     $response = new \Response($view);
     return $response;
 }
Exemplo n.º 3
0
 public function getController(\Request $request)
 {
     \Current_User::requireLogin();
     $cmd = $request->shiftCommand();
     if ($cmd == 'Admin' && \Current_User::allow('election')) {
         $admin = new \election\Controller\Admin($this);
         return $admin;
     } else {
         $user = new \election\Controller\User($this);
         return $user;
     }
 }
Exemplo n.º 4
0
 public function getJsonView($data, \Request $request)
 {
     $cmd = $request->shiftCommand();
     switch ($cmd) {
         case 'pager':
             return $this->listSchedules($request);
             break;
         default:
             throw new \Exception('JSON command not found');
     }
     return parent::getJsonView($data, $request);
 }
Exemplo n.º 5
0
 public function getController(\Request $request)
 {
     $cmd = $request->shiftCommand();
     if ($cmd == 'Admin') {
         if (\Current_User::allow('tailgate')) {
             $admin = new \tailgate\Controller\Admin($this);
             return $admin;
         } else {
             \Current_User::requireLogin();
         }
     } else {
         $user = new \tailgate\Controller\User($this);
         return $user;
     }
 }
Exemplo n.º 6
0
 protected function getJsonView($data, \Request $request)
 {
     $command = $request->shiftCommand();
     switch ($command) {
         case 'locationString':
             return $this->locationString();
             break;
         case 'getGoogleLink':
             return $this->getGoogleLink($request);
             break;
         case 'saveThumbnail':
             return $this->saveThumbnail($request);
             break;
     }
 }
Exemplo n.º 7
0
 public function getController(\Request $request)
 {
     $cmd = $request->shiftCommand();
     if (\Current_User::allow('sysinventory')) {
         switch ($cmd) {
             case 'system':
                 $system = new \systemsinventory\Controller\System($this);
                 return $system;
             case 'settings':
                 if (\Current_User::allow('systemsinventory', 'settings')) {
                     $settings = new \systemsinventory\Controller\Settings($this);
                     return $settings;
                 }
             default:
                 $search = new \systemsinventory\Controller\Search($this);
                 return $search;
         }
     } else {
         \Current_User::requireLogin();
     }
 }
Exemplo n.º 8
0
 public function getController(\Request $request)
 {
     $cmd = $request->shiftCommand();
     if ($cmd == 'admin' && \Current_User::isDeity()) {
         $admin = new \pulse\PulseAdminController($this);
         return $admin;
     } else {
         if (!\Settings::get('pulse', 'allow_web_access')) {
             exit('Web access to pulse is not allowed.');
         }
         try {
             PulseController::runSchedules($request);
         } catch (Exception\PulseException $e) {
             PulseFactory::logError($e->getMessage() . "\n" . $e->getFile() . ':' . $e->getLine());
             exit('Error: ' . $e->getMessage());
         } catch (\Exception $e) {
             PulseFactory::logError($e->getMessage() . "\n" . $e->getFile() . ':' . $e->getLine());
             exit('An error occurred outside the scope of Pulse.');
         }
         exit;
     }
 }