rename module constants and fix some unit test bugs

This commit is contained in:
Dennis Eichhorn 2021-09-28 18:28:42 +02:00
parent 41902316a5
commit 350681da34
6 changed files with 15 additions and 15 deletions

View File

@ -23,7 +23,7 @@ return [
'dest' => '\Modules\HumanResourceTimeRecording\Controller\ApiController:apiSessionCreate',
'verb' => RouteVerb::PUT,
'permission' => [
'module' => ApiController::MODULE_NAME,
'module' => ApiController::NAME,
'type' => PermissionType::CREATE,
'state' => PermissionState::SESSION,
],
@ -34,7 +34,7 @@ return [
'dest' => '\Modules\HumanResourceTimeRecording\Controller\ApiController:apiSessionElementCreate',
'verb' => RouteVerb::PUT,
'permission' => [
'module' => ApiController::MODULE_NAME,
'module' => ApiController::NAME,
'type' => PermissionType::CREATE,
'state' => PermissionState::SESSION_ELEMENT,
],

View File

@ -23,7 +23,7 @@ return [
'dest' => '\Modules\HumanResourceTimeRecording\Controller\BackendController:viewDashboard',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::MODULE_NAME,
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionState::DASHBOARD,
],
@ -34,7 +34,7 @@ return [
'dest' => '\Modules\HumanResourceTimeRecording\Controller\BackendController:viewPrivateDashboard',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::MODULE_NAME,
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionState::PRIVATE_DASHBOARD,
],
@ -45,7 +45,7 @@ return [
'dest' => '\Modules\HumanResourceTimeRecording\Controller\BackendController:viewPrivateSession',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::MODULE_NAME,
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionState::PRIVATE_DASHBOARD,
],

View File

@ -11,7 +11,7 @@ return [
'dest' => '\Modules\HumanResourceTimeRecording\Controller\TimerecordingController:viewDashboard',
'verb' => RouteVerb::GET,
'permission' => [
'module' => TimerecordingController::MODULE_NAME,
'module' => TimerecordingController::NAME,
'type' => PermissionType::READ,
'state' => PermissionState::DASHBOARD,
],
@ -22,7 +22,7 @@ return [
'dest' => '\Modules\HumanResourceTimeRecording\Controller\TimerecordingController:viewDashboard',
'verb' => RouteVerb::GET,
'permission' => [
'module' => TimerecordingController::MODULE_NAME,
'module' => TimerecordingController::NAME,
'type' => PermissionType::READ,
'state' => PermissionState::DASHBOARD,
],

View File

@ -62,7 +62,7 @@ final class ApiController extends Controller
if ($request->getData('account') !== null) {
if (!$this->app->accountManager->get($request->header->account)->hasPermission(
PermissionType::READ, $this->app->orgId, $this->app->appName, self::MODULE_NAME, PermissionState::SESSION_FOREIGN
PermissionType::READ, $this->app->orgId, $this->app->appName, self::NAME, PermissionState::SESSION_FOREIGN
)) {
$this->fillJsonResponse($request, $response, NotificationLevel::HIDDEN, '', '', []);
}
@ -115,7 +115,7 @@ final class ApiController extends Controller
if ($request->getData('account') !== null) {
if (!$this->app->accountManager->get($request->header->account)->hasPermission(
PermissionType::CREATE, $this->app->orgId, $this->app->appName, self::MODULE_NAME, PermissionState::SESSION_FOREIGN
PermissionType::CREATE, $this->app->orgId, $this->app->appName, self::NAME, PermissionState::SESSION_FOREIGN
)) {
return null;
}
@ -245,7 +245,7 @@ final class ApiController extends Controller
|| $session->getEmployee()->profile->account->getId() !== $request->header->account
) {
if (!$this->app->accountManager->get($request->header->account)->hasPermission(
PermissionType::CREATE, $this->app->orgId, $this->app->appName, self::MODULE_NAME, PermissionState::SESSION_ELEMENT_FOREIGN
PermissionType::CREATE, $this->app->orgId, $this->app->appName, self::NAME, PermissionState::SESSION_ELEMENT_FOREIGN
)) {
return null;
}

View File

@ -32,7 +32,7 @@ class Controller extends ModuleAbstract
* @var string
* @since 1.0.0
*/
public const MODULE_PATH = __DIR__ . '/../';
public const PATH = __DIR__ . '/../';
/**
* Module version.
@ -40,7 +40,7 @@ class Controller extends ModuleAbstract
* @var string
* @since 1.0.0
*/
public const MODULE_VERSION = '1.0.0';
public const VERSION = '1.0.0';
/**
* Module name.
@ -48,7 +48,7 @@ class Controller extends ModuleAbstract
* @var string
* @since 1.0.0
*/
public const MODULE_NAME = 'HumanResourceTimeRecording';
public const NAME = 'HumanResourceTimeRecording';
/**
* Module id.
@ -56,7 +56,7 @@ class Controller extends ModuleAbstract
* @var int
* @since 1.0.0
*/
public const MODULE_ID = 1006300000;
public const ID = 1006300000;
/**
* Providing.

View File

@ -19,7 +19,7 @@ namespace Modules\HumanResourceTimeRecording\tests\Admin;
*/
class AdminTest extends \PHPUnit\Framework\TestCase
{
protected const MODULE_NAME = 'HumanResourceTimeRecording';
protected const NAME = 'HumanResourceTimeRecording';
protected const URI_LOAD = '';