예제 #1
0
    /**
     * @param $login
     * @param $password
     *
     * @param array $authScope
     * @return array
     */
    public function findUserByCredentials($login, $password)
    {
        $sql = '
            SELECT DISTINCT
                   um.USR_ID,
                   cm.CPM_NAME,
                   cm.CPM_EMAIL_TECH,
                   cm.CPM_IP_RANGES,
                   cm.CPM_FLAGS,
                   um.USR_LANGUAGE_CODE,
                   um.LCK_TP_HOST
              FROM    videkomaster.USER_MASTER um
                   LEFT JOIN
                      videkomaster.CONTPARTNER_MASTER cm
                   ON cm.USR_ID = um.USR_ID

             WHERE     cm.CPM_NAME = :LOGIN
                   AND um.USR_TYPE = 10
                   AND cm.CPM_PASSWORD IS NOT NULL
                   AND ( (cm.CPM_PASSWORD = :PASSWORD) OR (cm.CPM_PASSWORD = lower(videkomaster.F_MD5 (:PASSWORD))) )
        ';
        $query = $this->oracle->query($sql)->bindString('LOGIN', $login)->bindString('PASSWORD', $password);
        $result = $query->fetchRow();
        return $result;
    }
예제 #2
0
 /**
  * @return bool
  */
 public function getOracleIntegrationTest()
 {
     $sql = 'SELECT DISTINCT * FROM VIDEKOMASTER.USER_MASTER UMA WHERE UMA.USR_ID = :USR_ID ';
     $query = $this->oracle->query($sql)->bindString('USR_ID', CampointUidsEnum::AK);
     $result = $query->fetchRow();
     return $result['USR_LOGIN'] === 'akentner-TX';
 }
예제 #3
0
 /**
  * @param int $hostUid
  * @param int $transactionType
  * @param float $amount
  * @throws \UnexpectedValueException
  * @return int
  */
 public function insertMiscTransaction($hostUid, $transactionType, $amount)
 {
     TransactionTypeEnum::validate($transactionType);
     $out = null;
     $this->oracle->plsql('P_HOST_MISC_TX')->inInt($hostUid)->inInt($transactionType)->inDecimal($amount)->inString(null)->inInt(null)->outInt($out)->inInt(1)->inInt(null)->call();
     if ($out <= 0) {
         throw new \UnexpectedValueException('Could not bill HostUid ' . $hostUid . ' TransactionType ' . $transactionType . ' with amount ' . $amount);
     }
     return $out;
 }
예제 #4
0
    /**
     * @param array $uids
     *
     * @return array
     */
    public function findOptionsByIds(array $uids)
    {
        $sql = '
		SELECT uo.USR_ID "uid", uo.OPT_TP "optTp", uo.UOT_STATUS "value"
        FROM videkomaster.USER_OPTIONS uo
        WHERE     UO.USR_ID IN (SELECT COLUMN_VALUE FROM TABLE (:USRIDS))
              AND UO.OPT_TP IN (SELECT COLUMN_VALUE FROM TABLE (:OPTTPS))
        ';
        $query = $this->oracle->query($sql)->bindArrayInt('USRIDS', $uids)->bindArrayInt('OPTTPS', array_keys(OptionTypeEnum::$fieldMapping));
        $result = $query->fetchTree(2);
        return $result;
    }
예제 #5
0
 /**
  * keeps session alive
  *
  * @param String $sid
  * @return bool
  */
 public function keepAlive($sid)
 {
     $login = $uid = $sektor = $result = null;
     $this->oracle->plsql('P_SESSION_TIME_STAMP_V7')->inString($sid)->outString($login, 20)->outInt($uid)->outInt($sektor)->outInt($result)->inInt(0)->call();
     $success = $result === 0;
     return $success;
 }
예제 #6
0
    /**
     * @param $login
     * @param $password
     *
     * @param array $authScope
     * @return array
     */
    public function findUserByCredentials($login, $password, array $authScope = [])
    {
        if (!$authScope) {
            $authScope = $this->defaultAuthScope;
        }
        $sql = '
		SELECT DISTINCT
			   um.USR_ID,
			   um.USR_LOGIN,
			   um.USR_PWD,
			   um.USR_MASTERPWD,
			   ua.URA_EMAIL,
			   um.USR_LANGUAGE_CODE,
			   CASE
				  WHEN um.USR_MASTERPWD = :PASSWORD THEN 1
				  WHEN um.USR_MASTERPWD = videkomaster.F_MD5 (:PASSWORD) THEN 1
				  ELSE 0
			   END IS_MASTER,
   			   CASE
				  WHEN um.USR_TYPE = 0 THEN um.LCK_TP_GUEST
				  WHEN um.USR_TYPE = 1 THEN um.LCK_TP_HOST
				  WHEN um.USR_TYPE = 13 THEN um.LCK_TP_GUEST
				  ELSE -1
			   END LOCK_TYPE,
			   um.USR_TYPE
		  FROM    videkomaster.USER_MASTER um
			   LEFT JOIN
				  videkomaster.USER_ADDRESS ua
			   ON ua.ADD_TP = 1 AND ua.USR_ID = um.USR_ID
		 WHERE     um.USR_LOGIN = :LOGIN
			   AND USR_PWD IS NOT NULL
			   AND (   (USR_PWD = :PASSWORD)
					OR (USR_MASTERPWD = :PASSWORD)
					OR (USR_PWD = videkomaster.F_MD5 (:PASSWORD))
					OR (USR_MASTERPWD = videkomaster.F_MD5 (:PASSWORD)))
        ';
        if ($authScope != [UserTypeEnum::USER]) {
            $sql .= 'AND USR_TYPE IN ( SELECT COLUMN_VALUE FROM TABLE (:USRTYPE) )';
        }
        $query = $this->oracle->query($sql)->bindString('LOGIN', $login)->bindString('PASSWORD', $password);
        if ($authScope) {
            $authScopeInt = array_map('\\VXBase\\User\\Model\\UserTypeEnum::getDbMapping', $authScope);
            $query->bindArrayInt('USRTYPE', $authScopeInt);
        }
        $result = $query->fetchRow();
        return $result;
    }
예제 #7
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;
 }
예제 #8
0
 /**
  * @param $hostUid
  * @return array|null
  */
 public function findFtpUserByHostUid($hostUid)
 {
     $sql = '
         SELECT um.USR_ID AS "hostUid",
                UM.USR_LOGIN AS "login",
                UF.UFT_TEXT AS "password",
                UF.UFT_START_DATE AS "created",
                UF.UFT_TIMESTAMP AS "modified"
           FROM    VIDEKOMASTER.USER_MASTER um
                INNER JOIN
                   VIDEKOMASTER.USER_FEATURES uf
                ON     UF.USR_ID = UM.USR_ID
                   AND UF.FTR_TP = 405
          WHERE UM.USR_ID = :USRID
     ';
     $query = $this->oracle->query($sql)->bindString('USRID', (int) $hostUid);
     $result = $query->fetchRow();
     return $result;
 }
 /**
  * @param $sid
  * @return bool
  */
 private function oracleKeepAlive($sid)
 {
     $login = $uid = $sektor = $return = null;
     $this->oracle->plsql('P_SESSION_TIME_STAMP_V7')->inString($sid)->outString($login, 20)->outInt($uid)->outInt($sektor)->outInt($return)->inInt(0)->call();
     return $return === 0;
 }
예제 #10
0
 /**
  * @param array $uids
  * @param int $ftrType
  */
 public function deleteFeatureForUids(array $uids, $ftrType)
 {
     $this->oracle->plsql('PKG_USER_FEATURE.MULTI_DELETE')->inArrayInt($uids)->inInt((int) $ftrType)->call();
 }