changed badly named permission type to permission category because type should only be read/write/...

This commit is contained in:
Dennis Eichhorn 2022-03-17 23:01:30 +01:00
parent f9ca5d951c
commit 3fb0c113c8
3 changed files with 12 additions and 12 deletions

View File

@ -13,7 +13,7 @@
declare(strict_types=1); declare(strict_types=1);
use Modules\Kanban\Controller\BackendController; use Modules\Kanban\Controller\BackendController;
use Modules\Kanban\Models\PermissionState; use Modules\Kanban\Models\PermissionCategory;
use phpOMS\Account\PermissionType; use phpOMS\Account\PermissionType;
use phpOMS\Router\RouteVerb; use phpOMS\Router\RouteVerb;
@ -25,7 +25,7 @@ return [
'permission' => [ 'permission' => [
'module' => BackendController::NAME, 'module' => BackendController::NAME,
'type' => PermissionType::READ, 'type' => PermissionType::READ,
'state' => PermissionState::KANBAN, 'state' => PermissionCategory::KANBAN,
], ],
], ],
], ],
@ -36,7 +36,7 @@ return [
'permission' => [ 'permission' => [
'module' => BackendController::NAME, 'module' => BackendController::NAME,
'type' => PermissionType::READ, 'type' => PermissionType::READ,
'state' => PermissionState::KANBAN, 'state' => PermissionCategory::KANBAN,
], ],
], ],
], ],
@ -47,7 +47,7 @@ return [
'permission' => [ 'permission' => [
'module' => BackendController::NAME, 'module' => BackendController::NAME,
'type' => PermissionType::READ, 'type' => PermissionType::READ,
'state' => PermissionState::KANBAN, 'state' => PermissionCategory::KANBAN,
], ],
], ],
], ],
@ -58,7 +58,7 @@ return [
'permission' => [ 'permission' => [
'module' => BackendController::NAME, 'module' => BackendController::NAME,
'type' => PermissionType::READ, 'type' => PermissionType::READ,
'state' => PermissionState::BOARD, 'state' => PermissionCategory::BOARD,
], ],
], ],
], ],
@ -69,7 +69,7 @@ return [
'permission' => [ 'permission' => [
'module' => BackendController::NAME, 'module' => BackendController::NAME,
'type' => PermissionType::READ, 'type' => PermissionType::READ,
'state' => PermissionState::CARD, 'state' => PermissionCategory::CARD,
], ],
], ],
], ],
@ -80,7 +80,7 @@ return [
'permission' => [ 'permission' => [
'module' => BackendController::NAME, 'module' => BackendController::NAME,
'type' => PermissionType::CREATE, 'type' => PermissionType::CREATE,
'state' => PermissionState::KANBAN, 'state' => PermissionCategory::KANBAN,
], ],
], ],
], ],

View File

@ -16,7 +16,7 @@ namespace Modules\Kanban\Controller;
use Modules\Kanban\Models\KanbanBoardMapper; use Modules\Kanban\Models\KanbanBoardMapper;
use Modules\Kanban\Models\KanbanCardMapper; use Modules\Kanban\Models\KanbanCardMapper;
use Modules\Kanban\Models\PermissionState; use Modules\Kanban\Models\PermissionCategory;
use phpOMS\Account\PermissionType; use phpOMS\Account\PermissionType;
use phpOMS\Asset\AssetType; use phpOMS\Asset\AssetType;
use phpOMS\Contract\RenderableInterface; use phpOMS\Contract\RenderableInterface;
@ -117,7 +117,7 @@ final class BackendController extends Controller
if ($board->createdBy->getId() !== $accountId if ($board->createdBy->getId() !== $accountId
&& !$this->app->accountManager->get($accountId)->hasPermission( && !$this->app->accountManager->get($accountId)->hasPermission(
PermissionType::READ, $this->app->orgId, $this->app->appName, self::NAME, PermissionState::BOARD, $board->getId()) PermissionType::READ, $this->app->orgId, $this->app->appName, self::NAME, PermissionCategory::BOARD, $board->getId())
) { ) {
$view->setTemplate('/Web/Backend/Error/403_inline'); $view->setTemplate('/Web/Backend/Error/403_inline');
$response->header->status = RequestStatusCode::R_403; $response->header->status = RequestStatusCode::R_403;
@ -182,7 +182,7 @@ final class BackendController extends Controller
$accountId = $request->header->account; $accountId = $request->header->account;
if (!$this->app->accountManager->get($accountId)->hasPermission( if (!$this->app->accountManager->get($accountId)->hasPermission(
PermissionType::CREATE, $this->app->orgId, $this->app->appName, self::NAME, PermissionState::BOARD) PermissionType::CREATE, $this->app->orgId, $this->app->appName, self::NAME, PermissionCategory::BOARD)
) { ) {
$view->setTemplate('/Web/Backend/Error/403_inline'); $view->setTemplate('/Web/Backend/Error/403_inline');
$response->header->status = RequestStatusCode::R_403; $response->header->status = RequestStatusCode::R_403;
@ -227,7 +227,7 @@ final class BackendController extends Controller
if ($card->createdBy->getId() !== $accountId if ($card->createdBy->getId() !== $accountId
&& !$this->app->accountManager->get($accountId)->hasPermission( && !$this->app->accountManager->get($accountId)->hasPermission(
PermissionType::READ, $this->app->orgId, $this->app->appName, self::NAME, PermissionState::CARD, $card->getId()) PermissionType::READ, $this->app->orgId, $this->app->appName, self::NAME, PermissionCategory::CARD, $card->getId())
) { ) {
$view->setTemplate('/Web/Backend/Error/403_inline'); $view->setTemplate('/Web/Backend/Error/403_inline');
$response->header->status = RequestStatusCode::R_403; $response->header->status = RequestStatusCode::R_403;

View File

@ -24,7 +24,7 @@ use phpOMS\Stdlib\Base\Enum;
* @link https://karaka.app * @link https://karaka.app
* @since 1.0.0 * @since 1.0.0
*/ */
abstract class PermissionState extends Enum abstract class PermissionCategory extends Enum
{ {
public const BOARD = 1; public const BOARD = 1;