From 33fb434a21e9d09e7d59c87a2f0804109aa6199d Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Thu, 26 Jan 2023 21:54:13 +0100 Subject: [PATCH] org -> unit change, some new functionality --- Admin/Install/db.json | 4 ++-- Controller/BackendController.php | 4 ++-- tests/Controller/ApiControllerTest.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Admin/Install/db.json b/Admin/Install/db.json index fd5349e..051f39e 100755 --- a/Admin/Install/db.json +++ b/Admin/Install/db.json @@ -63,8 +63,8 @@ "type": "INT", "default": null, "null": true, - "foreignTable": "organization_unit", - "foreignKey": "organization_unit_id" + "foreignTable": "unit", + "foreignKey": "unit_id" }, "news_app": { "name": "news_app", diff --git a/Controller/BackendController.php b/Controller/BackendController.php index ce0dfe3..e45cf1e 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -173,7 +173,7 @@ final class BackendController extends Controller implements DashboardElementInte if ($article->createdBy->getId() !== $accountId && !$this->app->accountManager->get($accountId)->hasPermission( - PermissionType::READ, $this->app->orgId, $this->app->appName, self::NAME, PermissionCategory::NEWS, $article->getId()) + PermissionType::READ, $this->app->unitId, $this->app->appName, self::NAME, PermissionCategory::NEWS, $article->getId()) ) { $view->setTemplate('/Web/Backend/Error/403_inline'); $response->header->status = RequestStatusCode::R_403; @@ -199,7 +199,7 @@ final class BackendController extends Controller implements DashboardElementInte $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000601001, $request, $response)); $view->addData('news', $article); $view->addData('editable', $this->app->accountManager->get($accountId)->hasPermission( - PermissionType::MODIFY, $this->app->orgId, $this->app->appName, self::NAME, PermissionCategory::NEWS, $article->getId()) + PermissionType::MODIFY, $this->app->unitId, $this->app->appName, self::NAME, PermissionCategory::NEWS, $article->getId()) ); // allow comments diff --git a/tests/Controller/ApiControllerTest.php b/tests/Controller/ApiControllerTest.php index e26f9bc..d4a2235 100755 --- a/tests/Controller/ApiControllerTest.php +++ b/tests/Controller/ApiControllerTest.php @@ -49,7 +49,7 @@ final class ControllerTest extends \PHPUnit\Framework\TestCase }; $this->app->dbPool = $GLOBALS['dbpool']; - $this->app->orgId = 1; + $this->app->unitId = 1; $this->app->accountManager = new AccountManager($GLOBALS['session']); $this->app->appSettings = new CoreSettings(); $this->app->moduleManager = new ModuleManager($this->app, __DIR__ . '/../../../Modules/');