| @@ 322-334 (lines=13) @@ | ||
| 319 | * @param $password |
|
| 320 | * @return bool |
|
| 321 | */ |
|
| 322 | public function auth($username, $password) { |
|
| 323 | if ($username !== 'system') { |
|
| 324 | return false; |
|
| 325 | } |
|
| 326 | $query = $this->connection->getQueryBuilder(); |
|
| 327 | $query->select('url')->from($this->dbTable) |
|
| 328 | ->where($query->expr()->eq('shared_secret', $query->createNamedParameter($password))); |
|
| 329 | ||
| 330 | $statement = $query->execute(); |
|
| 331 | $result = $statement->fetch(); |
|
| 332 | $statement->closeCursor(); |
|
| 333 | return !empty($result); |
|
| 334 | } |
|
| 335 | ||
| 336 | } |
|
| 337 | ||
| @@ 231-245 (lines=15) @@ | ||
| 228 | * @param int $id |
|
| 229 | * @return IJob|null |
|
| 230 | */ |
|
| 231 | public function getById($id) { |
|
| 232 | $query = $this->connection->getQueryBuilder(); |
|
| 233 | $query->select('*') |
|
| 234 | ->from('jobs') |
|
| 235 | ->where($query->expr()->eq('id', $query->createNamedParameter($id, IQueryBuilder::PARAM_INT))); |
|
| 236 | $result = $query->execute(); |
|
| 237 | $row = $result->fetch(); |
|
| 238 | $result->closeCursor(); |
|
| 239 | ||
| 240 | if ($row) { |
|
| 241 | return $this->buildJob($row); |
|
| 242 | } else { |
|
| 243 | return null; |
|
| 244 | } |
|
| 245 | } |
|
| 246 | ||
| 247 | /** |
|
| 248 | * get the job object from a row in the db |
|