mirror of
https://github.com/Karaka-Management/oms-Script.git
synced 2026-01-11 12:28:41 +00:00
org -> unit change, some new functionality
This commit is contained in:
parent
60793d3a7b
commit
5a850e43d3
|
|
@ -67,8 +67,8 @@
|
|||
"name": "helper_template_unit",
|
||||
"type": "INT",
|
||||
"null": true,
|
||||
"foreignTable": "organization_unit",
|
||||
"foreignKey": "organization_unit_id"
|
||||
"foreignTable": "unit",
|
||||
"foreignKey": "unit_id"
|
||||
},
|
||||
"helper_template_created": {
|
||||
"name": "helper_template_created",
|
||||
|
|
|
|||
|
|
@ -92,8 +92,8 @@ final class ApiController extends Controller
|
|||
$isExport = \in_array($request->getData('type'), ['xlsx', 'pdf', 'docx', 'pptx', 'csv', 'json']);
|
||||
|
||||
// is allowed to read
|
||||
if (!$this->app->accountManager->get($accountId)->hasPermission(PermissionType::READ, $this->app->orgId, null, self::NAME, PermissionCategory::REPORT, $template->getId())
|
||||
|| ($isExport && !$this->app->accountManager->get($accountId)->hasPermission(PermissionType::READ, $this->app->orgId, $this->app->appName, self::NAME, PermissionCategory::EXPORT))
|
||||
if (!$this->app->accountManager->get($accountId)->hasPermission(PermissionType::READ, $this->app->unitId, null, self::NAME, PermissionCategory::REPORT, $template->getId())
|
||||
|| ($isExport && !$this->app->accountManager->get($accountId)->hasPermission(PermissionType::READ, $this->app->unitId, $this->app->appName, self::NAME, PermissionCategory::EXPORT))
|
||||
) {
|
||||
$response->header->status = RequestStatusCode::R_403;
|
||||
|
||||
|
|
@ -409,7 +409,7 @@ final class ApiController extends Controller
|
|||
}
|
||||
|
||||
// is allowed to create
|
||||
if (!$this->app->accountManager->get($request->header->account)->hasPermission(PermissionType::CREATE, $this->app->orgId, null, self::NAME, PermissionCategory::TEMPLATE)) {
|
||||
if (!$this->app->accountManager->get($request->header->account)->hasPermission(PermissionType::CREATE, $this->app->unitId, null, self::NAME, PermissionCategory::TEMPLATE)) {
|
||||
$response->header->status = RequestStatusCode::R_403;
|
||||
|
||||
return;
|
||||
|
|
@ -465,7 +465,7 @@ final class ApiController extends Controller
|
|||
$this->app->moduleManager->get('Admin')->createAccountModelPermission(
|
||||
new AccountPermission(
|
||||
$request->header->account,
|
||||
$this->app->orgId,
|
||||
$this->app->unitId,
|
||||
$this->app->appName,
|
||||
self::NAME,
|
||||
self::NAME,
|
||||
|
|
@ -579,7 +579,7 @@ final class ApiController extends Controller
|
|||
}
|
||||
|
||||
// is allowed to create
|
||||
if (!$this->app->accountManager->get($request->header->account)->hasPermission(PermissionType::CREATE, $this->app->orgId, null, self::NAME, PermissionCategory::REPORT)) {
|
||||
if (!$this->app->accountManager->get($request->header->account)->hasPermission(PermissionType::CREATE, $this->app->unitId, null, self::NAME, PermissionCategory::REPORT)) {
|
||||
$response->header->status = RequestStatusCode::R_403;
|
||||
|
||||
return;
|
||||
|
|
@ -617,7 +617,7 @@ final class ApiController extends Controller
|
|||
$this->app->moduleManager->get('Admin')->createAccountModelPermission(
|
||||
new AccountPermission(
|
||||
$request->header->account,
|
||||
$this->app->orgId,
|
||||
$this->app->unitId,
|
||||
$this->app->appName,
|
||||
self::NAME,
|
||||
self::NAME,
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ final class BackendController extends Controller
|
|||
$view->addData('rcoll', $rcoll);
|
||||
}
|
||||
|
||||
$view->addData('unit', $this->app->orgId);
|
||||
$view->addData('unit', $this->app->unitId);
|
||||
$view->addData('tcoll', $tcoll);
|
||||
$view->addData('lang', $request->getData('lang') ?? $request->getLanguage());
|
||||
$view->addData('template', $template);
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ final class ApiControllerTest 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/');
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ 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/');
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user