| @@ 29-57 (lines=29) @@ | ||
| 26 | /** |
|
| 27 | * Admin controller class. |
|
| 28 | */ |
|
| 29 | abstract class AbstractAdminController extends AbstractController |
|
| 30 | { |
|
| 31 | ||
| 32 | /** |
|
| 33 | * This is the default action handling the main area called without defining arguments. |
|
| 34 | * |
|
| 35 | * @param Request $request Current request instance |
|
| 36 | * |
|
| 37 | * @return mixed Output |
|
| 38 | * |
|
| 39 | * @throws AccessDeniedException Thrown if the user doesn't have required permissions |
|
| 40 | */ |
|
| 41 | public function indexAction(Request $request) |
|
| 42 | { |
|
| 43 | // parameter specifying which type of objects we are treating |
|
| 44 | $objectType = $request->query->getAlnum('ot', 'route'); |
|
| 45 | ||
| 46 | $permLevel = ACCESS_ADMIN; |
|
| 47 | if (!$this->hasPermission($this->name . '::', '::', $permLevel)) { |
|
| 48 | throw new AccessDeniedException(); |
|
| 49 | } |
|
| 50 | ||
| 51 | // redirect to view action |
|
| 52 | $routeArea = 'admin'; |
|
| 53 | ||
| 54 | return $this->redirectToRoute('zikularoutesmodule_' . strtolower($objectType) . '_' . $routeArea . 'view'); |
|
| 55 | } |
|
| 56 | ||
| 57 | } |
|
| 58 | ||
| @@ 29-57 (lines=29) @@ | ||
| 26 | /** |
|
| 27 | * User controller class. |
|
| 28 | */ |
|
| 29 | abstract class AbstractUserController extends AbstractController |
|
| 30 | { |
|
| 31 | ||
| 32 | /** |
|
| 33 | * This is the default action handling the index area called without defining arguments. |
|
| 34 | * |
|
| 35 | * @param Request $request Current request instance |
|
| 36 | * |
|
| 37 | * @return mixed Output |
|
| 38 | * |
|
| 39 | * @throws AccessDeniedException Thrown if the user doesn't have required permissions |
|
| 40 | */ |
|
| 41 | public function indexAction(Request $request) |
|
| 42 | { |
|
| 43 | // parameter specifying which type of objects we are treating |
|
| 44 | $objectType = $request->query->getAlnum('ot', 'route'); |
|
| 45 | ||
| 46 | $permLevel = ACCESS_OVERVIEW; |
|
| 47 | if (!$this->hasPermission($this->name . '::', '::', $permLevel)) { |
|
| 48 | throw new AccessDeniedException(); |
|
| 49 | } |
|
| 50 | ||
| 51 | // redirect to view action |
|
| 52 | $routeArea = ''; |
|
| 53 | ||
| 54 | return $this->redirectToRoute('zikularoutesmodule_' . strtolower($objectType) . '_' . $routeArea . 'view'); |
|
| 55 | } |
|
| 56 | ||
| 57 | } |
|
| 58 | ||