Exemplo n.º 1
0
 public function procede()
 {
     try {
         if ($this->oRequest->existParam('user') && !$this->oRequest->existParam('edit')) {
             $this->add();
         }
         if ($this->oRequest->existParam('edit')) {
             $oApiKey = new ApiKey($this->oRequest->getParam('edit', 'string'), $this->oRequest->getParam('user', 'int'), $this->oRequest->getParam('read', 'boolean'), $this->oRequest->getParam('write', 'boolean'));
             if ($this->oRequest->existParam('delete') && $this->oRequest->getParam('delete', 'boolean')) {
                 $oApiKey->delete();
                 Logger::log('admin', Language::translate('API_ADMIN_KEY_DELLOG') . $this->oRequest->getParam('edit', 'string') . ' [' . $this->oCurrentUser->getLogin() . ']');
                 $this->oView->addAlert(Language::translate('API_ADMIN_KEY_DEL'), 'success');
             } else {
                 $oApiKey->update();
                 Logger::log('admin', Language::translate('API_ADMIN_KEY_UPDATELOG') . $this->oRequest->getParam('edit', 'string') . ' [' . $this->oCurrentUser->getLogin() . ']');
                 $this->oView->addAlert(Language::translate('API_ADMIN_KEY_UPDATE'), 'success');
             }
         }
     } catch (Exception $e) {
         $this->oView->addAlert($e, 'danger');
     } finally {
         $this->createView();
     }
 }