mirror of
https://github.com/Karaka-Management/oms-Exchange.git
synced 2026-01-29 09:18:40 +00:00
parent
3835a18659
commit
d53ecf17bb
|
|
@ -1,18 +1,31 @@
|
|||
<?php
|
||||
|
||||
use phpOMS\Router\RouteVerb;
|
||||
use phpOMS\Account\PermissionType;
|
||||
use Modules\Exchange\Models\PermissionState;
|
||||
use Modules\Exchange\Controller;
|
||||
|
||||
return [
|
||||
'^.*/api/admin/exchange/import/profile.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Exchange\Controller:apiExchangeImport',
|
||||
'verb' => RouteVerb::SET,
|
||||
'permission' => [
|
||||
'module' => Controller::MODULE_NAME,
|
||||
'type' => PermissionType::CREATE,
|
||||
'state' => PermissionState::IMPORT,
|
||||
],
|
||||
],
|
||||
],
|
||||
'^.*/api/admin/exchange/export/profile.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Exchange\Controller:apiExchangeExport',
|
||||
'verb' => RouteVerb::SET,
|
||||
'permission' => [
|
||||
'module' => Controller::MODULE_NAME,
|
||||
'type' => PermissionType::CREATE,
|
||||
'state' => PermissionState::EXPORT,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,36 +1,64 @@
|
|||
<?php
|
||||
|
||||
use phpOMS\Router\RouteVerb;
|
||||
use phpOMS\Account\PermissionType;
|
||||
use Modules\Exchange\Models\PermissionState;
|
||||
use Modules\Exchange\Controller;
|
||||
|
||||
return [
|
||||
'^.*/backend/admin/exchange/import/list.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Exchange\Controller:viewExchangeImportList',
|
||||
'verb' => RouteVerb::GET,
|
||||
'permission' => [
|
||||
'module' => Controller::MODULE_NAME,
|
||||
'type' => PermissionType::READ,
|
||||
'state' => PermissionState::IMPORT,
|
||||
],
|
||||
],
|
||||
],
|
||||
'^.*/backend/admin/exchange/export/list.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Exchange\Controller:viewExchangeExportList',
|
||||
'verb' => RouteVerb::GET,
|
||||
'permission' => [
|
||||
'module' => Controller::MODULE_NAME,
|
||||
'type' => PermissionType::READ,
|
||||
'state' => PermissionState::EXPORT,
|
||||
],
|
||||
],
|
||||
],
|
||||
'^.*/backend/admin/exchange/import/profile.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Exchange\Controller:viewExchangeImport',
|
||||
'verb' => RouteVerb::GET,
|
||||
'permission' => [
|
||||
'module' => Controller::MODULE_NAME,
|
||||
'type' => PermissionType::READ,
|
||||
'state' => PermissionState::IMPORT,
|
||||
],
|
||||
],
|
||||
],
|
||||
'^.*/backend/admin/exchange/export/profile.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Exchange\Controller:viewExchangeExport',
|
||||
'verb' => RouteVerb::GET,
|
||||
'permission' => [
|
||||
'module' => Controller::MODULE_NAME,
|
||||
'type' => PermissionType::READ,
|
||||
'state' => PermissionState::EXPORT,
|
||||
],
|
||||
],
|
||||
],
|
||||
'^.*/backend/admin/exchange/dashboard.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Exchange\Controller:viewExchangeDashboard',
|
||||
'verb' => RouteVerb::GET,
|
||||
'permission' => [
|
||||
'module' => Controller::MODULE_NAME,
|
||||
'type' => PermissionType::READ,
|
||||
'state' => PermissionState::DASHBOARD,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -227,14 +227,6 @@ final class Controller extends ModuleAbstract implements WebInterface
|
|||
*/
|
||||
public function apiExchangeImport(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
|
||||
{
|
||||
if (!$this->app->accountManager->get($request->getHeader()->getAccount())->hasPermission(
|
||||
PermissionType::MODIFY, $this->app->orgId, $this->app->appName, self::MODULE_NAME, PermissionState::IMPORT)
|
||||
) {
|
||||
$response->set('exchange_import', null);
|
||||
$response->getHeader()->setStatusCode(RequestStatusCode::R_403);
|
||||
return;
|
||||
}
|
||||
|
||||
$import = $this->importDataFromRequest($request);
|
||||
$status = NotificationLevel::ERROR;
|
||||
$message = 'Import failed.';
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ use phpOMS\Stdlib\Base\Enum;
|
|||
*/
|
||||
abstract class PermissionState extends Enum
|
||||
{
|
||||
public const IMPORT = 1;
|
||||
public const EXPORT = 2;
|
||||
public const IMPORT = 1;
|
||||
public const EXPORT = 2;
|
||||
public const DASHBOARD = 3;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user