This commit is contained in:
Dennis Eichhorn 2018-08-17 20:02:29 +02:00
parent d52cea4c65
commit 052fcf7aaf
3 changed files with 11 additions and 12 deletions

View File

@ -1,12 +1,20 @@
<?php <?php
use phpOMS\Router\RouteVerb; use phpOMS\Router\RouteVerb;
use phpOMS\Account\PermissionType;
use Modules\Calendar\Models\PermissionState;
use Modules\Calendar\Controller;
return [ return [
'^.*/backend/calendar/dashboard.*$' => [ '^.*/backend/calendar/dashboard.*$' => [
[ [
'dest' => '\Modules\Calendar\Controller:viewCalendarDashboard', 'dest' => '\Modules\Calendar\Controller:viewCalendarDashboard',
'verb' => RouteVerb::GET, 'verb' => RouteVerb::GET,
'permission' => [
'module' => Controller::MODULE_NAME,
'type' => PermissionType::READ,
'state' => PermissionState::CALENDAR,
],
], ],
], ],
]; ];

View File

@ -104,13 +104,6 @@ final class Controller extends ModuleAbstract implements WebInterface
{ {
$view = new View($this->app, $request, $response); $view = new View($this->app, $request, $response);
if (!$this->app->accountManager->get($request->getHeader()->getAccount())->hasPermission(
PermissionType::READ, $this->app->orgId, $this->app->appName, self::MODULE_NAME, PermissionState::DASHBOARD)
) {
$view->setTemplate('/Web/Backend/Error/403_inline');
return $view;
}
/** @var Head $head */ /** @var Head $head */
$head = $response->get('Content')->getData('head'); $head = $response->get('Content')->getData('head');
$head->addAsset(AssetType::CSS, '/Modules/Calendar/Theme/Backend/css/styles.css'); $head->addAsset(AssetType::CSS, '/Modules/Calendar/Theme/Backend/css/styles.css');

View File

@ -4,7 +4,7 @@
* *
* PHP Version 7.2 * PHP Version 7.2
* *
* @package TBD * @package Modules\Calendar
* @copyright Dennis Eichhorn * @copyright Dennis Eichhorn
* @license OMS License 1.0 * @license OMS License 1.0
* @version 1.0.0 * @version 1.0.0
@ -19,14 +19,12 @@ use phpOMS\Stdlib\Base\Enum;
/** /**
* Permision state enum. * Permision state enum.
* *
* @package Tasks * @package Modules\Calendar
* @license OMS License 1.0 * @license OMS License 1.0
* @link http://website.orange-management.de * @link http://website.orange-management.de
* @since 1.0.0 * @since 1.0.0
*/ */
abstract class PermissionState extends Enum abstract class PermissionState extends Enum
{ {
public const DASHBOARD = 1; public const CALENDAR = 1;
public const EVENT = 2;
public const CALENDAR = 3;
} }