| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 4 |
| CRAP Score | 4.5435 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 30 | 1 | public function getAccessibleSubQuery(?\Ecodev\Felix\Model\User $user): string |
|
| 31 | { |
||
| 32 | 1 | if (!$user) { |
|
| 33 | return '-1'; |
||
| 34 | } |
||
| 35 | |||
| 36 | // Sysops and responsible can read all logs |
||
| 37 | 1 | if (in_array($user->getRole(), [User::ROLE_RESPONSIBLE, User::ROLE_ADMINISTRATOR], true)) { |
|
| 38 | 1 | return $this->getAllIdsQuery(); |
|
| 39 | } |
||
| 40 | |||
| 41 | $subquery = ' |
||
| 42 | SELECT log.id FROM `log` WHERE |
||
| 43 | message LIKE ' . $this->getEntityManager()->getConnection()->quote(self::DOOR_OPENED . '%') . ' |
||
| 44 | AND log.creator_id = ' . $user->getId(); |
||
| 45 | |||
| 46 | return $subquery; |
||
| 47 | } |
||
| 49 |