| @@ 121-151 (lines=31) @@ | ||
| 118 | * |
|
| 119 | * @return array |
|
| 120 | */ |
|
| 121 | public function load($userId) |
|
| 122 | { |
|
| 123 | $query = $this->handler->createSelectQuery(); |
|
| 124 | $query->select( |
|
| 125 | $this->handler->quoteColumn('contentobject_id', 'ezuser'), |
|
| 126 | $this->handler->quoteColumn('login', 'ezuser'), |
|
| 127 | $this->handler->quoteColumn('email', 'ezuser'), |
|
| 128 | $this->handler->quoteColumn('password_hash', 'ezuser'), |
|
| 129 | $this->handler->quoteColumn('password_hash_type', 'ezuser'), |
|
| 130 | $this->handler->quoteColumn('is_enabled', 'ezuser_setting'), |
|
| 131 | $this->handler->quoteColumn('max_login', 'ezuser_setting') |
|
| 132 | )->from( |
|
| 133 | $this->handler->quoteTable('ezuser') |
|
| 134 | )->leftJoin( |
|
| 135 | $this->handler->quoteTable('ezuser_setting'), |
|
| 136 | $query->expr->eq( |
|
| 137 | $this->handler->quoteColumn('user_id', 'ezuser_setting'), |
|
| 138 | $this->handler->quoteColumn('contentobject_id', 'ezuser') |
|
| 139 | ) |
|
| 140 | )->where( |
|
| 141 | $query->expr->eq( |
|
| 142 | $this->handler->quoteColumn('contentobject_id', 'ezuser'), |
|
| 143 | $query->bindValue($userId, null, \PDO::PARAM_INT) |
|
| 144 | ) |
|
| 145 | ); |
|
| 146 | ||
| 147 | $statement = $query->prepare(); |
|
| 148 | $statement->execute(); |
|
| 149 | ||
| 150 | return $statement->fetchAll(\PDO::FETCH_ASSOC); |
|
| 151 | } |
|
| 152 | ||
| 153 | /** |
|
| 154 | * Loads user with user login. |
|
| @@ 160-191 (lines=32) @@ | ||
| 157 | * |
|
| 158 | * @return array |
|
| 159 | */ |
|
| 160 | public function loadByLogin($login) |
|
| 161 | { |
|
| 162 | $query = $this->handler->createSelectQuery(); |
|
| 163 | $query->select( |
|
| 164 | $this->handler->quoteColumn('contentobject_id', 'ezuser'), |
|
| 165 | $this->handler->quoteColumn('login', 'ezuser'), |
|
| 166 | $this->handler->quoteColumn('email', 'ezuser'), |
|
| 167 | $this->handler->quoteColumn('password_hash', 'ezuser'), |
|
| 168 | $this->handler->quoteColumn('password_hash_type', 'ezuser'), |
|
| 169 | $this->handler->quoteColumn('is_enabled', 'ezuser_setting'), |
|
| 170 | $this->handler->quoteColumn('max_login', 'ezuser_setting') |
|
| 171 | )->from( |
|
| 172 | $this->handler->quoteTable('ezuser') |
|
| 173 | )->leftJoin( |
|
| 174 | $this->handler->quoteTable('ezuser_setting'), |
|
| 175 | $query->expr->eq( |
|
| 176 | $this->handler->quoteColumn('user_id', 'ezuser_setting'), |
|
| 177 | $this->handler->quoteColumn('contentobject_id', 'ezuser') |
|
| 178 | ) |
|
| 179 | )->where( |
|
| 180 | $query->expr->eq( |
|
| 181 | $query->expr->lower($this->handler->quoteColumn('login', 'ezuser')), |
|
| 182 | // Index is case in-sensitive, on some db's lowercase, so we lowercase $login |
|
| 183 | $query->bindValue(mb_strtolower($login, 'UTF-8'), null, \PDO::PARAM_STR) |
|
| 184 | ) |
|
| 185 | ); |
|
| 186 | ||
| 187 | $statement = $query->prepare(); |
|
| 188 | $statement->execute(); |
|
| 189 | ||
| 190 | return $statement->fetchAll(\PDO::FETCH_ASSOC); |
|
| 191 | } |
|
| 192 | ||
| 193 | /** |
|
| 194 | * Loads user with user email. |
|
| @@ 200-230 (lines=31) @@ | ||
| 197 | * |
|
| 198 | * @return array |
|
| 199 | */ |
|
| 200 | public function loadByEmail($email) |
|
| 201 | { |
|
| 202 | $query = $this->handler->createSelectQuery(); |
|
| 203 | $query->select( |
|
| 204 | $this->handler->quoteColumn('contentobject_id', 'ezuser'), |
|
| 205 | $this->handler->quoteColumn('login', 'ezuser'), |
|
| 206 | $this->handler->quoteColumn('email', 'ezuser'), |
|
| 207 | $this->handler->quoteColumn('password_hash', 'ezuser'), |
|
| 208 | $this->handler->quoteColumn('password_hash_type', 'ezuser'), |
|
| 209 | $this->handler->quoteColumn('is_enabled', 'ezuser_setting'), |
|
| 210 | $this->handler->quoteColumn('max_login', 'ezuser_setting') |
|
| 211 | )->from( |
|
| 212 | $this->handler->quoteTable('ezuser') |
|
| 213 | )->leftJoin( |
|
| 214 | $this->handler->quoteTable('ezuser_setting'), |
|
| 215 | $query->expr->eq( |
|
| 216 | $this->handler->quoteColumn('user_id', 'ezuser_setting'), |
|
| 217 | $this->handler->quoteColumn('contentobject_id', 'ezuser') |
|
| 218 | ) |
|
| 219 | )->where( |
|
| 220 | $query->expr->eq( |
|
| 221 | $this->handler->quoteColumn('email', 'ezuser'), |
|
| 222 | $query->bindValue($email, null, \PDO::PARAM_STR) |
|
| 223 | ) |
|
| 224 | ); |
|
| 225 | ||
| 226 | $statement = $query->prepare(); |
|
| 227 | $statement->execute(); |
|
| 228 | ||
| 229 | return $statement->fetchAll(\PDO::FETCH_ASSOC); |
|
| 230 | } |
|
| 231 | ||
| 232 | /** |
|
| 233 | * Loads a user with user hash key. |
|