| Conditions | 4 |
| Paths | 4 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 6 | public function validateIsAdmin($request, $nonFatal = false) |
||
| 7 | { |
||
| 8 | $this->user = $request->getAttribute('user'); |
||
| 9 | if($this->user === false) |
||
| 10 | { |
||
| 11 | throw new Exception('Must be logged in', \Http\Rest\ACCESS_DENIED); |
||
| 12 | } |
||
| 13 | if(!$this->user->isInGroupNamed('LDAPAdmins')) |
||
| 14 | { |
||
| 15 | if($nonFatal) |
||
| 16 | { |
||
| 17 | return false; |
||
| 18 | } |
||
| 19 | throw new Exception('Must be Admin', \Http\Rest\ACCESS_DENIED); |
||
| 20 | } |
||
| 21 | return true; |
||
| 22 | } |
||
| 23 | } |
||
| 24 |