| @@ 45-76 (lines=32) @@ | ||
| 42 | * |
|
| 43 | * @return array |
|
| 44 | */ |
|
| 45 | public function load($userId) |
|
| 46 | { |
|
| 47 | $query = $this->handler->createSelectQuery(); |
|
| 48 | $query->select( |
|
| 49 | $this->handler->quoteColumn('contentobject_id', 'ezuser'), |
|
| 50 | $this->handler->quoteColumn('login', 'ezuser'), |
|
| 51 | $this->handler->quoteColumn('email', 'ezuser'), |
|
| 52 | $this->handler->quoteColumn('password_hash', 'ezuser'), |
|
| 53 | $this->handler->quoteColumn('password_hash_type', 'ezuser'), |
|
| 54 | $this->handler->quoteColumn('password_updated_at', 'ezuser'), |
|
| 55 | $this->handler->quoteColumn('is_enabled', 'ezuser_setting'), |
|
| 56 | $this->handler->quoteColumn('max_login', 'ezuser_setting') |
|
| 57 | )->from( |
|
| 58 | $this->handler->quoteTable('ezuser') |
|
| 59 | )->leftJoin( |
|
| 60 | $this->handler->quoteTable('ezuser_setting'), |
|
| 61 | $query->expr->eq( |
|
| 62 | $this->handler->quoteColumn('user_id', 'ezuser_setting'), |
|
| 63 | $this->handler->quoteColumn('contentobject_id', 'ezuser') |
|
| 64 | ) |
|
| 65 | )->where( |
|
| 66 | $query->expr->eq( |
|
| 67 | $this->handler->quoteColumn('contentobject_id', 'ezuser'), |
|
| 68 | $query->bindValue($userId, null, \PDO::PARAM_INT) |
|
| 69 | ) |
|
| 70 | ); |
|
| 71 | ||
| 72 | $statement = $query->prepare(); |
|
| 73 | $statement->execute(); |
|
| 74 | ||
| 75 | return $statement->fetchAll(\PDO::FETCH_ASSOC); |
|
| 76 | } |
|
| 77 | ||
| 78 | /** |
|
| 79 | * Loads user with user login. |
|
| @@ 85-117 (lines=33) @@ | ||
| 82 | * |
|
| 83 | * @return array |
|
| 84 | */ |
|
| 85 | public function loadByLogin($login) |
|
| 86 | { |
|
| 87 | $query = $this->handler->createSelectQuery(); |
|
| 88 | $query->select( |
|
| 89 | $this->handler->quoteColumn('contentobject_id', 'ezuser'), |
|
| 90 | $this->handler->quoteColumn('login', 'ezuser'), |
|
| 91 | $this->handler->quoteColumn('email', 'ezuser'), |
|
| 92 | $this->handler->quoteColumn('password_hash', 'ezuser'), |
|
| 93 | $this->handler->quoteColumn('password_hash_type', 'ezuser'), |
|
| 94 | $this->handler->quoteColumn('password_updated_at', 'ezuser'), |
|
| 95 | $this->handler->quoteColumn('is_enabled', 'ezuser_setting'), |
|
| 96 | $this->handler->quoteColumn('max_login', 'ezuser_setting') |
|
| 97 | )->from( |
|
| 98 | $this->handler->quoteTable('ezuser') |
|
| 99 | )->leftJoin( |
|
| 100 | $this->handler->quoteTable('ezuser_setting'), |
|
| 101 | $query->expr->eq( |
|
| 102 | $this->handler->quoteColumn('user_id', 'ezuser_setting'), |
|
| 103 | $this->handler->quoteColumn('contentobject_id', 'ezuser') |
|
| 104 | ) |
|
| 105 | )->where( |
|
| 106 | $query->expr->eq( |
|
| 107 | $query->expr->lower($this->handler->quoteColumn('login', 'ezuser')), |
|
| 108 | // Index is case in-sensitive, on some db's lowercase, so we lowercase $login |
|
| 109 | $query->bindValue(mb_strtolower($login, 'UTF-8'), null, \PDO::PARAM_STR) |
|
| 110 | ) |
|
| 111 | ); |
|
| 112 | ||
| 113 | $statement = $query->prepare(); |
|
| 114 | $statement->execute(); |
|
| 115 | ||
| 116 | return $statement->fetchAll(\PDO::FETCH_ASSOC); |
|
| 117 | } |
|
| 118 | ||
| 119 | /** |
|
| 120 | * Loads user with user email. |
|
| @@ 126-157 (lines=32) @@ | ||
| 123 | * |
|
| 124 | * @return array |
|
| 125 | */ |
|
| 126 | public function loadByEmail($email) |
|
| 127 | { |
|
| 128 | $query = $this->handler->createSelectQuery(); |
|
| 129 | $query->select( |
|
| 130 | $this->handler->quoteColumn('contentobject_id', 'ezuser'), |
|
| 131 | $this->handler->quoteColumn('login', 'ezuser'), |
|
| 132 | $this->handler->quoteColumn('email', 'ezuser'), |
|
| 133 | $this->handler->quoteColumn('password_hash', 'ezuser'), |
|
| 134 | $this->handler->quoteColumn('password_hash_type', 'ezuser'), |
|
| 135 | $this->handler->quoteColumn('password_updated_at', 'ezuser'), |
|
| 136 | $this->handler->quoteColumn('is_enabled', 'ezuser_setting'), |
|
| 137 | $this->handler->quoteColumn('max_login', 'ezuser_setting') |
|
| 138 | )->from( |
|
| 139 | $this->handler->quoteTable('ezuser') |
|
| 140 | )->leftJoin( |
|
| 141 | $this->handler->quoteTable('ezuser_setting'), |
|
| 142 | $query->expr->eq( |
|
| 143 | $this->handler->quoteColumn('user_id', 'ezuser_setting'), |
|
| 144 | $this->handler->quoteColumn('contentobject_id', 'ezuser') |
|
| 145 | ) |
|
| 146 | )->where( |
|
| 147 | $query->expr->eq( |
|
| 148 | $this->handler->quoteColumn('email', 'ezuser'), |
|
| 149 | $query->bindValue($email, null, \PDO::PARAM_STR) |
|
| 150 | ) |
|
| 151 | ); |
|
| 152 | ||
| 153 | $statement = $query->prepare(); |
|
| 154 | $statement->execute(); |
|
| 155 | ||
| 156 | return $statement->fetchAll(\PDO::FETCH_ASSOC); |
|
| 157 | } |
|
| 158 | ||
| 159 | /** |
|
| 160 | * Loads a user with user hash key. |
|