Exemplo n.º 1
0
 /**
 * logs in host
 *
 * @param string $login
 * @param string $password
 * @param string $remoteAddress
 * @param bool $isMasterAccount
 *
 *@return null|SessionDeprecated
 * @throws ForbiddenException
 * @throws SessionAlreadyExistsException
 * @throws UnauthorizedException
 */
 public function createSessionInOracle($login, $password, $remoteAddress, $isMasterAccount = false)
 {
     $session = null;
     $now = new DateTimeImmutable();
     $sessionId = '';
     $sid = '';
     $uid = 0;
     $returnValue = 0;
     $isMasterAccount = $isMasterAccount ? 1 : 0;
     $this->oracle->plsql('P_HOST_SENDERTOOL_LOGIN_V8')->inString($login)->inString($password)->inString($remoteAddress)->inString('')->outInt($sessionId)->outString($sid, 40)->inInt($isMasterAccount)->outInt($uid)->outInt($returnValue)->call();
     if ($returnValue >= 0) {
         $sessionData = ['uid' => $uid, 'userType' => $this->userFactory->getUserTypeById($uid), 'login' => $login, 'isMasterAccount' => $isMasterAccount, 'sid' => $sessionId, 'sessionType' => SessionTypeEnum::SID_SESSION, 'validFrom' => $now, 'validUntil' => $now->add(new DateInterval('PT' . SidSessionType::TIMEOUT_HOST . 'S')), 'remoteAddress' => $remoteAddress, 'active' => true];
         $session = SessionDeprecated::createFromArray($sessionData);
     } else {
         $this->handleError($returnValue, $login);
     }
     return $session;
 }
Exemplo n.º 2
0
 /**
  * @param $userId
  * @param $key
  * @param $lang
  * @return string
  */
 private function buildKey($userId, $key, $lang)
 {
     $userType = $this->userFactory->getUserTypeById($userId);
     return 'users:' . $userType . ':' . $userId . ':texts:' . $key . ':' . $lang;
 }