org -> unit change, some new functionality

This commit is contained in:
Dennis Eichhorn 2023-01-26 21:54:13 +01:00
parent 8bbfdb8baf
commit 33fb434a21
3 changed files with 5 additions and 5 deletions

View File

@ -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",

View File

@ -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

View File

@ -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/');