fix billing process

This commit is contained in:
Dennis Eichhorn 2023-04-08 04:36:26 +02:00
parent b0fd52b651
commit 9eb8b8e7d6
4 changed files with 21 additions and 17 deletions

View File

@ -8,9 +8,11 @@ assignees: ''
---
# Bug Description
A clear and concise description of what the bug is.
# How to Reproduce
Steps to reproduce the behavior:
1. Go to '...'
@ -19,16 +21,20 @@ Steps to reproduce the behavior:
4. See error
# Expected Behavior
A clear and concise description of what you expected to happen.
# Screenshots
If applicable, add screenshots to help explain your problem.
# System Information
- System: [e.g. PC or iPhone11, ...]
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- KarakaVersion [e.g. 22]
- System: [e.g. PC or iPhone11, ...]
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- KarakaVersion [e.g. 22]
# Additional Information
Add any other context about the problem here.

View File

@ -178,18 +178,14 @@ final class Application
if (!($account instanceof NullAccount)) {
$response->header->l11n = $account->l11n;
} elseif ($this->app->sessionManager->get('language') !== null) {
} elseif ($this->app->sessionManager->get('language') !== null
&& $response->header->l11n->getLanguage() !== $this->app->sessionManager->get('language')
) {
$response->header->l11n
->loadFromLanguage(
$this->app->sessionManager->get('language'),
$this->app->sessionManager->get('country') ?? '*'
);
} elseif ($this->app->cookieJar->get('language') !== null) {
$response->header->l11n
->loadFromLanguage(
$this->app->cookieJar->get('language'),
$this->app->cookieJar->get('country') ?? '*'
);
}
UriFactory::setQuery('/lang', $response->getLanguage());
@ -212,7 +208,7 @@ final class Application
}
/* No reading permission */
if (!$account->hasPermission(PermissionType::READ, $this->app->unitId, $this->app->appName, 'Dashboard')) {
if (!$account->hasPermission(PermissionType::READ, $this->app->unitId, $this->app->appId, 'Dashboard')) {
$this->create403Response($response, $pageView);
return;
@ -226,7 +222,7 @@ final class Application
$request->uri->getRoute(),
$request->getDataString('CSRF'),
$request->getRouteVerb(),
$this->app->appName,
$this->app->appId,
$this->app->unitId,
$account,
$request->getData()

View File

@ -47,7 +47,9 @@ export class Application {
this.request.setRootPath(
HttpUri.parseUrl(
document.getElementsByTagName('base')[0].href
typeof document.getElementsByTagName('base')[0] !== 'undefined'
? document.getElementsByTagName('base')[0].href
: ''
).path
);

View File

@ -57,7 +57,7 @@ final class ApiController extends Controller
public function apiSessionCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
{
if ($request->hasData('account') && !$this->app->accountManager->get($request->header->account)->hasPermission(
PermissionType::CREATE, $this->app->unitId, $this->app->appName, self::NAME, PermissionCategory::SESSION_FOREIGN
PermissionType::CREATE, $this->app->unitId, $this->app->appId, self::NAME, PermissionCategory::SESSION_FOREIGN
)) {
$response->header->status = RequestStatusCode::R_403;
@ -153,7 +153,7 @@ final class ApiController extends Controller
if ($request->hasData('account') && ((int) $request->getData('account')) !== $request->header->account
) {
if (!$this->app->accountManager->get($request->header->account)->hasPermission(
PermissionType::CREATE, $this->app->unitId, $this->app->appName, self::NAME, PermissionCategory::SESSION_ELEMENT_FOREIGN
PermissionType::CREATE, $this->app->unitId, $this->app->appId, self::NAME, PermissionCategory::SESSION_ELEMENT_FOREIGN
)) {
$response->header->status = RequestStatusCode::R_403;
@ -195,7 +195,7 @@ final class ApiController extends Controller
private function validateSessionElementCreate(RequestAbstract $request) : array
{
$val = [];
if (($val['session'] = empty($request->getData('session')) || !\is_numeric($request->getData('session')))) {
if (($val['session'] = !$request->hasData('session') || !\is_numeric($request->getData('session')))) {
return $val;
}