Ejemplo n.º 1
0
 public function authenticate()
 {
     if ($this->data->datasource == '') {
         $this->data->datasource = 'fnapolo';
         //$this->renderPrompt('error', 'Inform database name.');
     }
     Manager::setConf('fnbr20.db', $this->data->datasource);
     Manager::getSession()->fnbr20db = $this->data->datasource;
     $auth = Manager::getAuth();
     $this->data->result = $auth->authenticate($this->data->user, $this->data->challenge, $this->data->response);
     if ($this->data->result) {
         $user = Manager::getLogin()->getUser();
         $this->data->idLanguage = $user->getConfigData('fnbr20IdLanguage');
         if ($this->data->idLanguage == '') {
             $this->data->idLanguage = 1;
             $user->setConfigData('fnbr20IdLanguage', $this->data->idLanguage);
         }
         if ($this->data->ifLanguage == '') {
             $this->data->ifLanguage = 'en';
             //$this->renderPrompt('error', 'Inform language.');
         }
         Manager::getSession()->idLanguage = $this->data->idLanguage;
         Manager::getSession()->lang = $this->data->ifLanguage;
         Manager::getSession()->fnbr20Level = $user->getUserLevel();
         $this->redirect(Manager::getURL('fnbr20/main'));
     } else {
         $this->renderPrompt('error', 'Login or password not valid.');
     }
 }
Ejemplo n.º 2
0
 public function save()
 {
     $layers = $this->data->gridManager->data->checked;
     Manager::getSession()->fnbr20Layers = $layers;
     $user = Manager::getLogin()->getUser();
     $user->setConfigData('fnbr20Layers', $layers);
     $this->renderPrompt('information', 'OK');
 }
 public function newTimeLine($tl)
 {
     $timeline = 'tl_' . $tl;
     $result = $this->getCriteria()->select('max(numOrder) as max')->where("upper(timeline) = upper('{$timeline}')")->asQuery()->getResult();
     $max = $result[0]['max'];
     $order = ($max ?: 0) + 1;
     $this->setPersistent(false);
     $this->setTimeLine($timeline);
     $this->setNumOrder($order);
     $this->setTlDateTime(\Manager::getSysTime());
     $author = \Manager::getLogin()->getLogin();
     $this->setAuthor($author);
     $this->save();
     return $timeline;
 }
Ejemplo n.º 4
0
 public function getCommand($operacao, $classe, $idModel, $descricao)
 {
     $this->operacao = $operacao;
     $this->descricao = $descricao;
     $this->classe = $classe;
     $this->idModel = $idModel;
     $this->idModulo = $idModulo == '' ? '1' : $idModulo;
     $login = \Manager::getLogin();
     if ($idUsuario == '') {
         $login = \Manager::getLogin();
         $idUsuario = $login ? $login->getIdUser() : 1;
     }
     $this->idUsuario = $idUsuario;
     $this->getClassMap()->setObjectKey($this);
     $statement = $this->getClassMap()->getInsertSqlFor($this);
     return $statement->insert();
 }
Ejemplo n.º 5
0
 public function isMemberOf($group)
 {
     $groups = Manager::getLogin()->getGroups();
     $ok = $groups[strtoupper($group)] || $groups['ADMIN'];
     return $ok;
 }
Ejemplo n.º 6
0
 /**
  * Brief Description.
  * Complete Description.
  *
  * @param $msg (tipo) desc
  *
  * @returns (tipo) desc
  *
  */
 private function handlerDb($msg)
 {
     $login = Manager::getLogin();
     $uid = $login ? $login->getLogin() : '';
     $ts = Manager::getSysTime();
     $db = Manager::getDatabase('manager');
     $idLog = $db->getNewId('seq_manager_log');
     $sql = new MSQL('idlog, timestamp, login, msg, host', 'manager_log');
     $db->execute($sql->insert(array($idLog, $ts, $uid, $msg, $this->host)));
 }
Ejemplo n.º 7
0
 public static function getCurrentUser()
 {
     $user = \Manager::getLogin()->getUser();
     return $user;
 }