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