| @@ 15-26 (lines=12) @@ | ||
| 12 | $app->get('/{name}/leads', array($this, 'getLeads')); |
|
| 13 | } |
|
| 14 | ||
| 15 | protected function validateIsAdmin($request) |
|
| 16 | { |
|
| 17 | $user = $request->getAttribute('user'); |
|
| 18 | if($user === false) |
|
| 19 | { |
|
| 20 | throw new Exception('Must be logged in', \Http\Rest\ACCESS_DENIED); |
|
| 21 | } |
|
| 22 | if(!$user->isInGroupNamed('LDAPAdmins')) |
|
| 23 | { |
|
| 24 | throw new Exception('Must be Admin', \Http\Rest\ACCESS_DENIED); |
|
| 25 | } |
|
| 26 | } |
|
| 27 | ||
| 28 | protected function canCreate($request) |
|
| 29 | { |
|
| @@ 14-25 (lines=12) @@ | ||
| 11 | parent::setup($app); |
|
| 12 | } |
|
| 13 | ||
| 14 | protected function validateIsAdmin($request) |
|
| 15 | { |
|
| 16 | $user = $request->getAttribute('user'); |
|
| 17 | if($user === false) |
|
| 18 | { |
|
| 19 | throw new Exception('Must be logged in', \Http\Rest\ACCESS_DENIED); |
|
| 20 | } |
|
| 21 | if(!$user->isInGroupNamed('LDAPAdmins')) |
|
| 22 | { |
|
| 23 | throw new Exception('Must be Admin', \Http\Rest\ACCESS_DENIED); |
|
| 24 | } |
|
| 25 | } |
|
| 26 | ||
| 27 | protected function canCreate($request) |
|
| 28 | { |
|
| @@ 12-23 (lines=12) @@ | ||
| 9 | $app->map(['GET', 'POST'], '/{hash}/Actions/activate[/]', array($this, 'activatePendingUser')); |
|
| 10 | } |
|
| 11 | ||
| 12 | protected function validateIsAdmin($request) |
|
| 13 | { |
|
| 14 | $user = $request->getAttribute('user'); |
|
| 15 | if($user === false) |
|
| 16 | { |
|
| 17 | throw new Exception('Must be logged in', \Http\Rest\ACCESS_DENIED); |
|
| 18 | } |
|
| 19 | if(!$user->isInGroupNamed('LDAPAdmins')) |
|
| 20 | { |
|
| 21 | throw new Exception('Must be Admin', \Http\Rest\ACCESS_DENIED); |
|
| 22 | } |
|
| 23 | } |
|
| 24 | ||
| 25 | public function listPendingUsers($request, $response, $args) |
|
| 26 | { |
|
| @@ 10-21 (lines=12) @@ | ||
| 7 | $app->delete('/{id}', array($this, 'endSession')); |
|
| 8 | } |
|
| 9 | ||
| 10 | protected function validateIsAdmin($request) |
|
| 11 | { |
|
| 12 | $user = $request->getAttribute('user'); |
|
| 13 | if($user === false) |
|
| 14 | { |
|
| 15 | throw new Exception('Must be logged in', \Http\Rest\ACCESS_DENIED); |
|
| 16 | } |
|
| 17 | if(!$user->isInGroupNamed('LDAPAdmins')) |
|
| 18 | { |
|
| 19 | throw new Exception('Must be Admin', \Http\Rest\ACCESS_DENIED); |
|
| 20 | } |
|
| 21 | } |
|
| 22 | ||
| 23 | public function getSessions($request, $response, $args) |
|
| 24 | { |
|