mirror of
https://github.com/Karaka-Management/oms-HumanResourceTimeRecording.git
synced 2026-01-15 21:58:41 +00:00
org -> unit change, some new functionality
This commit is contained in:
parent
5bfdcbf5c7
commit
27660d13ce
|
|
@ -167,8 +167,8 @@ final class Application
|
|||
$this->app->accountManager = new AccountManager($this->app->sessionManager);
|
||||
$this->app->l11nServer = LocalizationMapper::get()->where('id', 1)->execute();
|
||||
|
||||
$this->app->orgId = $this->getApplicationOrganization($request, $this->config);
|
||||
$pageView->setData('orgId', $this->app->orgId);
|
||||
$this->app->unitId = $this->getApplicationOrganization($request, $this->config);
|
||||
$pageView->setData('unitId', $this->app->unitId);
|
||||
|
||||
$aid = Auth::authenticate($this->app->sessionManager);
|
||||
$request->header->account = $aid;
|
||||
|
|
@ -212,7 +212,7 @@ final class Application
|
|||
}
|
||||
|
||||
/* No reading permission */
|
||||
if (!$account->hasPermission(PermissionType::READ, $this->app->orgId, $this->app->appName, 'Dashboard')) {
|
||||
if (!$account->hasPermission(PermissionType::READ, $this->app->unitId, $this->app->appName, 'Dashboard')) {
|
||||
$this->create403Response($response, $pageView);
|
||||
|
||||
return;
|
||||
|
|
@ -227,7 +227,7 @@ final class Application
|
|||
$request->getData('CSRF'),
|
||||
$request->getRouteVerb(),
|
||||
$this->app->appName,
|
||||
$this->app->orgId,
|
||||
$this->app->unitId,
|
||||
$account,
|
||||
$request->getData()
|
||||
),
|
||||
|
|
@ -252,7 +252,7 @@ final class Application
|
|||
return (int) (
|
||||
$request->getData('u') ?? (
|
||||
$config['domains'][$request->uri->host]['org'] ?? $this->app->appSettings->get(
|
||||
SettingsEnum::DEFAULT_ORGANIZATION
|
||||
SettingsEnum::DEFAULT_UNIT
|
||||
) ?? 1
|
||||
)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -262,13 +262,13 @@ $head = $this->getData('head');
|
|||
<div class="inputWithIcon">
|
||||
<input id="iName" type="text" name="user" tabindex="3" value="admin" autofocus>
|
||||
<i class="frontIcon fa fa-user fa-lg fa-fw" aria-hidden="true"></i>
|
||||
<i class="endIcon fa fa-times fa-lg fa-fw" aria-hidden="true"></i>
|
||||
<i class="endIcon fa fa-times close fa-lg fa-fw" aria-hidden="true"></i>
|
||||
</div>
|
||||
<label for="iPassword"><?= $this->getHtml('Password', '0', '0'); ?>:</label>
|
||||
<div class="inputWithIcon">
|
||||
<input id="iPassword" type="password" name="pass" tabindex="4" value="orange">
|
||||
<i class="frontIcon fa fa-lock fa-lg fa-fw" aria-hidden="true"></i>
|
||||
<i class="endIcon fa fa-times fa-lg fa-fw" aria-hidden="true"></i>
|
||||
<i class="endIcon fa fa-times close fa-lg fa-fw" aria-hidden="true"></i>
|
||||
</div>
|
||||
<input id="iLoginButton" name="loginButton" type="submit" value="<?= $this->getHtml('Login', '0', '0'); ?>" tabindex="5">
|
||||
<button class="cancelButton" name="cancelButton" type="button" tabindex="6"><?= $this->getHtml('Cancel', '0', '0'); ?></button>
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ final class ApiController extends Controller
|
|||
public function apiSessionCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
|
||||
{
|
||||
if ($request->getData('account') !== null && !$this->app->accountManager->get($request->header->account)->hasPermission(
|
||||
PermissionType::CREATE, $this->app->orgId, $this->app->appName, self::NAME, PermissionCategory::SESSION_FOREIGN
|
||||
PermissionType::CREATE, $this->app->unitId, $this->app->appName, self::NAME, PermissionCategory::SESSION_FOREIGN
|
||||
)) {
|
||||
$response->header->status = RequestStatusCode::R_403;
|
||||
|
||||
|
|
@ -154,7 +154,7 @@ final class ApiController extends Controller
|
|||
if ($request->getData('account') !== null && ((int) $request->getData('account')) !== $request->header->account
|
||||
) {
|
||||
if (!$this->app->accountManager->get($request->header->account)->hasPermission(
|
||||
PermissionType::CREATE, $this->app->orgId, $this->app->appName, self::NAME, PermissionCategory::SESSION_ELEMENT_FOREIGN
|
||||
PermissionType::CREATE, $this->app->unitId, $this->app->appName, self::NAME, PermissionCategory::SESSION_ELEMENT_FOREIGN
|
||||
)) {
|
||||
$response->header->status = RequestStatusCode::R_403;
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,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/');
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user