mirror of
https://github.com/Karaka-Management/oms-Editor.git
synced 2026-02-14 17:28:42 +00:00
changed badly named permission type to permission category because type should only be read/write/...
This commit is contained in:
parent
ccdf62ae04
commit
6573a545ca
|
|
@ -13,7 +13,7 @@
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Modules\Editor\Controller\ApiController;
|
use Modules\Editor\Controller\ApiController;
|
||||||
use Modules\Editor\Models\PermissionState;
|
use Modules\Editor\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' => ApiController::NAME,
|
'module' => ApiController::NAME,
|
||||||
'type' => PermissionType::CREATE,
|
'type' => PermissionType::CREATE,
|
||||||
'state' => PermissionState::DOC,
|
'state' => PermissionCategory::DOC,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -34,7 +34,7 @@ return [
|
||||||
'permission' => [
|
'permission' => [
|
||||||
'module' => ApiController::NAME,
|
'module' => ApiController::NAME,
|
||||||
'type' => PermissionType::MODIFY,
|
'type' => PermissionType::MODIFY,
|
||||||
'state' => PermissionState::DOC,
|
'state' => PermissionCategory::DOC,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -43,7 +43,7 @@ return [
|
||||||
'permission' => [
|
'permission' => [
|
||||||
'module' => ApiController::NAME,
|
'module' => ApiController::NAME,
|
||||||
'type' => PermissionType::READ,
|
'type' => PermissionType::READ,
|
||||||
'state' => PermissionState::DOC,
|
'state' => PermissionCategory::DOC,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -52,7 +52,7 @@ return [
|
||||||
'permission' => [
|
'permission' => [
|
||||||
'module' => ApiController::NAME,
|
'module' => ApiController::NAME,
|
||||||
'type' => PermissionType::DELETE,
|
'type' => PermissionType::DELETE,
|
||||||
'state' => PermissionState::DOC,
|
'state' => PermissionCategory::DOC,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Modules\Editor\Controller\BackendController;
|
use Modules\Editor\Controller\BackendController;
|
||||||
use Modules\Editor\Models\PermissionState;
|
use Modules\Editor\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::CREATE,
|
'type' => PermissionType::CREATE,
|
||||||
'state' => PermissionState::DOC,
|
'state' => PermissionCategory::DOC,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -34,7 +34,7 @@ return [
|
||||||
'permission' => [
|
'permission' => [
|
||||||
'module' => BackendController::NAME,
|
'module' => BackendController::NAME,
|
||||||
'type' => PermissionType::CREATE,
|
'type' => PermissionType::CREATE,
|
||||||
'state' => PermissionState::DOC,
|
'state' => PermissionCategory::DOC,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
@ -45,7 +45,7 @@ return [
|
||||||
'permission' => [
|
'permission' => [
|
||||||
'module' => BackendController::NAME,
|
'module' => BackendController::NAME,
|
||||||
'type' => PermissionType::READ,
|
'type' => PermissionType::READ,
|
||||||
'state' => PermissionState::DOC,
|
'state' => PermissionCategory::DOC,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
@ -56,7 +56,7 @@ return [
|
||||||
'permission' => [
|
'permission' => [
|
||||||
'module' => BackendController::NAME,
|
'module' => BackendController::NAME,
|
||||||
'type' => PermissionType::READ,
|
'type' => PermissionType::READ,
|
||||||
'state' => PermissionState::DOC,
|
'state' => PermissionCategory::DOC,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
@ -67,7 +67,7 @@ return [
|
||||||
'permission' => [
|
'permission' => [
|
||||||
'module' => BackendController::NAME,
|
'module' => BackendController::NAME,
|
||||||
'type' => PermissionType::MODIFY,
|
'type' => PermissionType::MODIFY,
|
||||||
'state' => PermissionState::DOC,
|
'state' => PermissionCategory::DOC,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ declare(strict_types=1);
|
||||||
namespace Modules\Editor\Controller;
|
namespace Modules\Editor\Controller;
|
||||||
|
|
||||||
use Modules\Editor\Models\EditorDocMapper;
|
use Modules\Editor\Models\EditorDocMapper;
|
||||||
use Modules\Editor\Models\PermissionState;
|
use Modules\Editor\Models\PermissionCategory;
|
||||||
use Modules\Media\Models\CollectionMapper;
|
use Modules\Media\Models\CollectionMapper;
|
||||||
use phpOMS\Account\PermissionType;
|
use phpOMS\Account\PermissionType;
|
||||||
use phpOMS\Asset\AssetType;
|
use phpOMS\Asset\AssetType;
|
||||||
|
|
@ -144,7 +144,7 @@ final class BackendController extends Controller
|
||||||
|
|
||||||
if ($doc->createdBy->getId() !== $accountId
|
if ($doc->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::DOC, $doc->getId())
|
PermissionType::READ, $this->app->orgId, $this->app->appName, self::NAME, PermissionCategory::DOC, $doc->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;
|
||||||
|
|
@ -162,7 +162,7 @@ final class BackendController extends Controller
|
||||||
$view->addData('tagSelector', $tagSelector);
|
$view->addData('tagSelector', $tagSelector);
|
||||||
|
|
||||||
$view->addData('editable', $this->app->accountManager->get($accountId)->hasPermission(
|
$view->addData('editable', $this->app->accountManager->get($accountId)->hasPermission(
|
||||||
PermissionType::MODIFY, $this->app->orgId, $this->app->appName, self::NAME, PermissionState::DOC, $doc->getId())
|
PermissionType::MODIFY, $this->app->orgId, $this->app->appName, self::NAME, PermissionCategory::DOC, $doc->getId())
|
||||||
);
|
);
|
||||||
|
|
||||||
return $view;
|
return $view;
|
||||||
|
|
@ -190,7 +190,7 @@ final class BackendController extends Controller
|
||||||
|
|
||||||
if ($doc->createdBy->getId() !== $accountId
|
if ($doc->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::DOC, $doc->getId())
|
PermissionType::READ, $this->app->orgId, $this->app->appName, self::NAME, PermissionCategory::DOC, $doc->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;
|
||||||
|
|
|
||||||
|
|
@ -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 DOC = 1;
|
public const DOC = 1;
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user