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:29 +01:00
parent a75633a0b4
commit bd8d1ddd16
5 changed files with 14 additions and 14 deletions

View File

@ -13,7 +13,7 @@
declare(strict_types=1);
use Modules\HumanResourceTimeRecording\Controller\ApiController;
use Modules\HumanResourceTimeRecording\Models\PermissionState;
use Modules\HumanResourceTimeRecording\Models\PermissionCategory;
use phpOMS\Account\PermissionType;
use phpOMS\Router\RouteVerb;
@ -25,7 +25,7 @@ return [
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::CREATE,
'state' => PermissionState::SESSION,
'state' => PermissionCategory::SESSION,
],
],
],
@ -36,7 +36,7 @@ return [
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::CREATE,
'state' => PermissionState::SESSION_ELEMENT,
'state' => PermissionCategory::SESSION_ELEMENT,
],
],
],

View File

@ -13,7 +13,7 @@
declare(strict_types=1);
use Modules\HumanResourceTimeRecording\Controller\BackendController;
use Modules\HumanResourceTimeRecording\Models\PermissionState;
use Modules\HumanResourceTimeRecording\Models\PermissionCategory;
use phpOMS\Account\PermissionType;
use phpOMS\Router\RouteVerb;
@ -25,7 +25,7 @@ return [
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionState::DASHBOARD,
'state' => PermissionCategory::DASHBOARD,
],
],
],
@ -36,7 +36,7 @@ return [
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionState::PRIVATE_DASHBOARD,
'state' => PermissionCategory::PRIVATE_DASHBOARD,
],
],
],
@ -47,7 +47,7 @@ return [
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionState::PRIVATE_DASHBOARD,
'state' => PermissionCategory::PRIVATE_DASHBOARD,
],
],
],

View File

@ -1,7 +1,7 @@
<?php declare(strict_types=1);
use Modules\HumanResourceTimeRecording\Controller\TimerecordingController;
use Modules\HumanResourceTimeRecording\Models\PermissionState;
use Modules\HumanResourceTimeRecording\Models\PermissionCategory;
use phpOMS\Account\PermissionType;
use phpOMS\Router\RouteVerb;
@ -13,7 +13,7 @@ return [
'permission' => [
'module' => TimerecordingController::NAME,
'type' => PermissionType::READ,
'state' => PermissionState::DASHBOARD,
'state' => PermissionCategory::DASHBOARD,
],
],
],
@ -24,7 +24,7 @@ return [
'permission' => [
'module' => TimerecordingController::NAME,
'type' => PermissionType::READ,
'state' => PermissionState::DASHBOARD,
'state' => PermissionCategory::DASHBOARD,
],
],
],

View File

@ -19,7 +19,7 @@ use Modules\HumanResourceManagement\Models\NullEmployee;
use Modules\HumanResourceTimeRecording\Models\ClockingStatus;
use Modules\HumanResourceTimeRecording\Models\ClockingType;
use Modules\HumanResourceTimeRecording\Models\NullSession;
use Modules\HumanResourceTimeRecording\Models\PermissionState;
use Modules\HumanResourceTimeRecording\Models\PermissionCategory;
use Modules\HumanResourceTimeRecording\Models\Session;
use Modules\HumanResourceTimeRecording\Models\SessionElement;
use Modules\HumanResourceTimeRecording\Models\SessionElementMapper;
@ -57,7 +57,7 @@ final class ApiController extends Controller
public function apiSessionCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
{
if ($request->getData('account') !== null && !$this->app->accountManager->get($request->header->account)->hasPermission(
PermissionType::CREATE, $this->app->orgId, $this->app->appName, self::NAME, PermissionState::SESSION_FOREIGN
PermissionType::CREATE, $this->app->orgId, $this->app->appName, self::NAME, PermissionCategory::SESSION_FOREIGN
)) {
$response->header->status = RequestStatusCode::R_403;
@ -154,7 +154,7 @@ final class ApiController extends Controller
if ($request->getData('account') !== null && ((int) $request->getData('account')) !== $request->header->account
) {
if (!$this->app->accountManager->get($request->header->account)->hasPermission(
PermissionType::CREATE, $this->app->orgId, $this->app->appName, self::NAME, PermissionState::SESSION_ELEMENT_FOREIGN
PermissionType::CREATE, $this->app->orgId, $this->app->appName, self::NAME, PermissionCategory::SESSION_ELEMENT_FOREIGN
)) {
$response->header->status = RequestStatusCode::R_403;

View File

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