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 633ba1ce72
commit 9cf826e66d
4 changed files with 27 additions and 27 deletions

View File

@ -13,7 +13,7 @@
declare(strict_types=1);
use Modules\Knowledgebase\Controller\ApiController;
use Modules\Knowledgebase\Models\PermissionState;
use Modules\Knowledgebase\Models\PermissionCategory;
use phpOMS\Account\PermissionType;
use phpOMS\Router\RouteVerb;
@ -25,7 +25,7 @@ return [
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::CREATE,
'state' => PermissionState::WIKI,
'state' => PermissionCategory::WIKI,
],
],
[
@ -34,7 +34,7 @@ return [
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::MODIFY,
'state' => PermissionState::WIKI,
'state' => PermissionCategory::WIKI,
],
],
[
@ -43,7 +43,7 @@ return [
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
'state' => PermissionState::WIKI,
'state' => PermissionCategory::WIKI,
],
],
[
@ -52,7 +52,7 @@ return [
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::DELETE,
'state' => PermissionState::WIKI,
'state' => PermissionCategory::WIKI,
],
],
],
@ -64,7 +64,7 @@ return [
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::CREATE,
'state' => PermissionState::CATEGORY,
'state' => PermissionCategory::CATEGORY,
],
],
[
@ -73,7 +73,7 @@ return [
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::MODIFY,
'state' => PermissionState::CATEGORY,
'state' => PermissionCategory::CATEGORY,
],
],
[
@ -82,7 +82,7 @@ return [
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
'state' => PermissionState::CATEGORY,
'state' => PermissionCategory::CATEGORY,
],
],
[
@ -91,7 +91,7 @@ return [
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::DELETE,
'state' => PermissionState::CATEGORY,
'state' => PermissionCategory::CATEGORY,
],
],
],
@ -103,7 +103,7 @@ return [
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::CREATE,
'state' => PermissionState::APP,
'state' => PermissionCategory::APP,
],
],
[
@ -112,7 +112,7 @@ return [
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::MODIFY,
'state' => PermissionState::APP,
'state' => PermissionCategory::APP,
],
],
[
@ -121,7 +121,7 @@ return [
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
'state' => PermissionState::APP,
'state' => PermissionCategory::APP,
],
],
[
@ -130,7 +130,7 @@ return [
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::DELETE,
'state' => PermissionState::APP,
'state' => PermissionCategory::APP,
],
],
],

View File

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

View File

@ -17,7 +17,7 @@ namespace Modules\Knowledgebase\Controller;
use Modules\Knowledgebase\Models\NullWikiApp;
use Modules\Knowledgebase\Models\NullWikiCategory;
use Modules\Knowledgebase\Models\NullWikiDoc;
use Modules\Knowledgebase\Models\PermissionState;
use Modules\Knowledgebase\Models\PermissionCategory;
use Modules\Knowledgebase\Models\WikiAppMapper;
use Modules\Knowledgebase\Models\WikiCategoryMapper;
use Modules\Knowledgebase\Models\WikiDocMapper;
@ -310,7 +310,7 @@ final class BackendController extends Controller
$accountId = $request->header->account;
if (!$this->app->accountManager->get($accountId)->hasPermission(
PermissionType::READ, $this->app->orgId, $this->app->appName, self::NAME, PermissionState::WIKI, $document->getId())
PermissionType::READ, $this->app->orgId, $this->app->appName, self::NAME, PermissionCategory::WIKI, $document->getId())
) {
$view->setTemplate('/Web/Backend/Error/403_inline');
$response->header->status = RequestStatusCode::R_403;
@ -330,7 +330,7 @@ final class BackendController extends Controller
$view->setData('categories', $categories);
$view->setData('document', $document);
$view->addData('editable', $this->app->accountManager->get($accountId)->hasPermission(
PermissionType::MODIFY, $this->app->orgId, $this->app->appName, self::NAME, PermissionState::WIKI, $document->getId())
PermissionType::MODIFY, $this->app->orgId, $this->app->appName, self::NAME, PermissionCategory::WIKI, $document->getId())
);
return $view;

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 CATEGORY = 1;