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