Beispiel #1
0
 /**
  * @param $login
  * @param $password
  * @param array $authScope
  * @return AbstractAuthAccount|null
  */
 public function getAuthAccountByCredentials($login, $password, array $authScope = [])
 {
     $authAccount = null;
     $result = $this->dataProvider->findUserByCredentials($login, $password, $authScope);
     if ($result) {
         $userType = UserTypeEnum::resolveUserType($result['USR_TYPE']);
         $authAccount = $this->buildAuthAccount($userType, $result);
     }
     return $authAccount;
 }
Beispiel #2
0
 /**
  * @param array $result
  *
  * @return Model\RealPerson
  */
 protected function buildModel(array $result)
 {
     $model = null;
     if (is_array($result) && count($result) > 0) {
         $mapping['uid'] = (int) $result['USR_ID'];
         $mapping['login'] = $result['USR_LOGIN'];
         $mapping['userType'] = UserTypeEnum::resolveUserType($result['USR_TYPE']);
         $mapping['hostUids'] = array_map('intval', explode(',', $result['hostUids']));
         $model = new Model\RealPerson();
         ObjectUtil::hydrateObject($model, $mapping);
     }
     return $model;
 }
Beispiel #3
0
 /**
  * @param array $result
  *
  * @return Model\User
  */
 protected function buildModel(array $result)
 {
     $model = null;
     if (is_array($result) && count($result) > 0) {
         $mapping['uid'] = $result['USR_ID'];
         $mapping['login'] = $result['USR_LOGIN'];
         $mapping['userType'] = UserTypeEnum::resolveUserType($result['USR_TYPE']);
         $mapping['password'] = $result['USR_PWD'];
         $mapping['masterPassword'] = $result['USR_MASTERPWD'];
         $mapping['onlineState'] = $result['ONLINE_STATE'];
         $model = new Model\User();
         ObjectUtil::hydrateObject($model, $mapping);
     }
     return $model;
 }
    /**
     * @param $login
     * @param array|string $userTypeScope
     * @internal param array $uids
     * @return array
     */
    protected function findUserByLogin($login, $userTypeScope = [])
    {
        if (!$userTypeScope) {
            $userTypeScope = $this->defaultUserTypeScope;
        }
        $sql = '
		SELECT
			um.USR_ID,
			um.USR_LOGIN,
			um.USR_PWD,
			um.USR_MASTERPWD,
			um.USR_TYPE,
			ses.SET_TP ONLINE_STATE
		FROM
			videkomaster.USER_MASTER um
		LEFT OUTER JOIN
			videkomaster.SESSIONS ses on (ses.USR_ID = um.USR_ID)
		WHERE
			um.LOGIN = :LOGIN
		';
        if ($userTypeScope != [UserTypeEnum::USER]) {
            $sql .= 'AND USR_TYPE IN ( SELECT COLUMN_VALUE FROM TABLE (:USRTYPE) )';
        }
        $query = $this->oracle->query($sql)->bindString('LOGIN', $login);
        if ($userTypeScope != [UserTypeEnum::USER]) {
            $query->bindArrayInt('USRTYPE', UserTypeEnum::getDbMapping(UserTypeEnum::HOST));
        }
        $result = $query->fetchAll();
        return $result;
    }