make id public, organigram impl. media password/encryption, settings bug fix, Money->FloatInt change, ...

This commit is contained in:
Dennis Eichhorn 2023-05-06 11:42:05 +00:00
parent fdc74c6d80
commit 375df875b4
47 changed files with 253 additions and 293 deletions

View File

@ -5,10 +5,19 @@
"to": "",
"cc": "",
"bcc": "",
"subject": "Registration confirmation",
"ishtml": true,
"body": "<!DOCTYPE html><html><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title>Registration Confirmation</title></head><body style=\"font-family: Arial, sans-serif; font-size: 16px; line-height: 1.5;\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\"><tr><td><table align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"600\" style=\"margin: 0 auto; background-color: #ffffff;\"><tr><td style=\"padding: 40px 0; text-align: center;\"><h1 style=\"margin-top: 0; color: #000000; font-size: 24px;\">Registration Confirmation</h1><p style=\"margin-bottom: 20px;\">Dear {user_name},</p><p style=\"margin-bottom: 20px;\">Thank you for registering for our service. Your account has been successfully created.</p><p style=\"margin-bottom: 20px;\">Your username is: {user_name}</p><p style=\"margin-bottom: 40px;\">To get started, please click on the following confirmation link:</p><a href=\"{confirmation_link}\" style=\"display: inline-block; padding: 10px 20px; background-color: #0070c0; color: #ffffff; text-decoration: none;\">Confirm</a></td></tr></table></td></tr></table></body></html>",
"bodyalt": "Dear {user_name},\n\nThank you for registering for our service. Your account has been successfully created.\n\nYour username is: {user_name}\n\nTo get started, please click on the following confirmation link: {confirmation_link}.\n\nThank you,\n\n[Your Company]",
"l11n": {
"en": {
"subject": "Registration confirmation",
"body": "<!DOCTYPE html><html><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title>Registration Confirmation</title></head><body style=\"font-family: Arial, sans-serif; font-size: 16px; line-height: 1.5;\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\"><tr><td><table align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"600\" style=\"margin: 0 auto; background-color: #ffffff;\"><tr><td style=\"padding: 40px 0; text-align: center;\"><h1 style=\"margin-top: 0; color: #000000; font-size: 24px;\">Registration Confirmation</h1><p style=\"margin-bottom: 20px;\">Dear {user_name},</p><p style=\"margin-bottom: 20px;\">Thank you for registering for our service. Your account has been successfully created.</p><p style=\"margin-bottom: 20px;\">Your username is: {user_name}</p><p style=\"margin-bottom: 40px;\">To get started, please click on the following confirmation link:</p><a href=\"{confirmation_link}\" style=\"display: inline-block; padding: 10px 20px; background-color: #0070c0; color: #ffffff; text-decoration: none;\">Confirm</a><p style=\"margin-top: 40px;\">Jingga e.K. - www.jingga.app - CEO Dennis Eichhorn</p></td></tr></table></td></tr></table></body></html>",
"bodyalt": "Dear {user_name},\n\nThank you for registering for our service. Your account has been successfully created.\n\nYour username is: {user_name}\n\nTo get started, please click on the following confirmation link: {confirmation_link}\n\n\nJingga e.K. - www.jingga.app - CEO Dennis Eichhorn"
},
"de": {
"subject": "Registrierungsbestätigung",
"body": "<!DOCTYPE html><html><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title>Registrierungsbestätigung</title></head><body style=\"font-family: Arial, sans-serif; font-size: 16px; line-height: 1.5;\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\"><tr><td><table align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"600\" style=\"margin: 0 auto; background-color: #ffffff;\"><tr><td style=\"padding: 40px 0; text-align: center;\"><h1 style=\"margin-top: 0; color: #000000; font-size: 24px;\">Registrierungsbestätigung</h1><p style=\"margin-bottom: 20px;\">Liebe(r) {user_name},</p><p style=\"margin-bottom: 20px;\">Vielen Dank für Ihre Registrierung bei unserem Service. Ihr Konto wurde erfolgreich erstellt.</p><p style=\"margin-bottom: 20px;\">Ihr Benutzername lautet: {user_name}</p><p style=\"margin-bottom: 40px;\">Um loszulegen, klicken Sie bitte auf den folgenden Bestätigungslink:</p><a href=\"{confirmation_link}\" style=\"display: inline-block; padding: 10px 20px; background-color: #0070c0; color: #ffffff; text-decoration: none;\">Bestätigen</a><p style=\"margin-top: 40px;\">Jingga e.K. - www.jingga.app - CEO Dennis Eichhorn</p></td></tr></table></td></tr></table></body></html>",
"bodyalt": "Liebe(r) {user_name},\n\nvielen Dank für Ihre Registrierung bei unserem Service. Ihr Konto wurde erfolgreich erstellt.\n\nIhr Benutzername lautet: {user_name}\n\nUm loszulegen, klicken Sie bitte auf den folgenden Bestätigungslink: {confirmation_link}\n\n\nJingga e.K. - www.jingga.app - CEO Dennis Eichhorn"
}
},
"send": false
},
{
@ -17,10 +26,19 @@
"to": "",
"cc": "",
"bcc": "",
"subject": "Account recovery",
"ishtml": true,
"body": "<!DOCTYPE html><html><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title>Registration Confirmation</title></head><body style=\"font-family: Arial, sans-serif; font-size: 16px; line-height: 1.5;\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\"><tr><td><table align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"600\" style=\"margin: 0 auto; background-color: #ffffff;\"><tr><td style=\"padding: 40px 0; text-align: center;\"><h1 style=\"margin-top: 0; color: #000000; font-size: 24px;\">Registration Confirmation</h1><p style=\"margin-bottom: 20px;\">Dear [Name],</p><p style=\"margin-bottom: 20px;\">Thank you for registering for our service. Your account has been successfully created.</p><p style=\"margin-bottom: 20px;\">Your username is: [Username]</p><p style=\"margin-bottom: 40px;\">To get started, please click on the following confirmation link:</p><a href=\"[Login Link]\" style=\"display: inline-block; padding: 10px 20px; background-color: #0070c0; color: #ffffff; text-decoration: none;\">Confirm</a></td></tr></table></td></tr></table></body></html>",
"bodyalt": "Dear [Name],\n\nThank you for registering for our service. Your account has been successfully created.\n\nYour username is: [Username]\n\nTo get started, please click on the following confirmation link: [Login Link].\n\nThank you,\n\n[Your Company]",
"l11n": {
"en": {
"subject": "Account recovery",
"body": "<!DOCTYPE html><html><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title>Registration Confirmation</title></head><body style=\"font-family: Arial, sans-serif; font-size: 16px; line-height: 1.5;\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\"><tr><td><table align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"600\" style=\"margin: 0 auto; background-color: #ffffff;\"><tr><td style=\"padding: 40px 0; text-align: center;\"><h1 style=\"margin-top: 0; color: #000000; font-size: 24px;\">Registration Confirmation</h1><p style=\"margin-bottom: 20px;\">Dear [Name],</p><p style=\"margin-bottom: 20px;\">Thank you for registering for our service. Your account has been successfully created.</p><p style=\"margin-bottom: 20px;\">Your username is: [Username]</p><p style=\"margin-bottom: 40px;\">To get started, please click on the following confirmation link:</p><a href=\"[Login Link]\" style=\"display: inline-block; padding: 10px 20px; background-color: #0070c0; color: #ffffff; text-decoration: none;\">Confirm</a><p style=\"margin-top: 40px;\">Jingga e.K. - www.jingga.app - CEO Dennis Eichhorn</p></td></tr></table></td></tr></table></body></html>",
"bodyalt": "Dear [Name],\n\nThank you for registering for our service. Your account has been successfully created.\n\nYour username is: [Username]\n\nTo get started, please click on the following confirmation link: [Login Link].\n\n\nJingga e.K. - www.jingga.app - CEO Dennis Eichhorn"
},
"de": {
"subject": "Account recovery",
"body": "<!DOCTYPE html><html><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title>Registration Confirmation</title></head><body style=\"font-family: Arial, sans-serif; font-size: 16px; line-height: 1.5;\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\"><tr><td><table align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"600\" style=\"margin: 0 auto; background-color: #ffffff;\"><tr><td style=\"padding: 40px 0; text-align: center;\"><h1 style=\"margin-top: 0; color: #000000; font-size: 24px;\">Registration Confirmation</h1><p style=\"margin-bottom: 20px;\">Dear [Name],</p><p style=\"margin-bottom: 20px;\">Thank you for registering for our service. Your account has been successfully created.</p><p style=\"margin-bottom: 20px;\">Your username is: [Username]</p><p style=\"margin-bottom: 40px;\">To get started, please click on the following confirmation link:</p><a href=\"[Login Link]\" style=\"display: inline-block; padding: 10px 20px; background-color: #0070c0; color: #ffffff; text-decoration: none;\">Confirm</a><p style=\"margin-top: 40px;\">Jingga e.K. - www.jingga.app - CEO Dennis Eichhorn</p></td></tr></table></td></tr></table></body></html>",
"bodyalt": "Dear [Name],\n\nThank you for registering for our service. Your account has been successfully created.\n\nYour username is: [Username]\n\nTo get started, please click on the following confirmation link: [Login Link].\n\n\nJingga e.K. - www.jingga.app - CEO Dennis Eichhorn"
}
},
"send": false
},
{
@ -29,10 +47,19 @@
"to": "",
"cc": "",
"bcc": "",
"subject": "Failed login",
"ishtml": true,
"body": "<!DOCTYPE html><html><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title>Registration Confirmation</title></head><body style=\"font-family: Arial, sans-serif; font-size: 16px; line-height: 1.5;\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\"><tr><td><table align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"600\" style=\"margin: 0 auto; background-color: #ffffff;\"><tr><td style=\"padding: 40px 0; text-align: center;\"><h1 style=\"margin-top: 0; color: #000000; font-size: 24px;\">Registration Confirmation</h1><p style=\"margin-bottom: 20px;\">Dear [Name],</p><p style=\"margin-bottom: 20px;\">Thank you for registering for our service. Your account has been successfully created.</p><p style=\"margin-bottom: 20px;\">Your username is: [Username]</p><p style=\"margin-bottom: 40px;\">To get started, please click on the following confirmation link:</p><a href=\"[Login Link]\" style=\"display: inline-block; padding: 10px 20px; background-color: #0070c0; color: #ffffff; text-decoration: none;\">Confirm</a></td></tr></table></td></tr></table></body></html>",
"bodyalt": "Dear [Name],\n\nThank you for registering for our service. Your account has been successfully created.\n\nYour username is: [Username]\n\nTo get started, please click on the following confirmation link: [Login Link].\n\nThank you,\n\n[Your Company]",
"l11n": {
"en": {
"subject": "Failed login",
"body": "<!DOCTYPE html><html><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title>Registration Confirmation</title></head><body style=\"font-family: Arial, sans-serif; font-size: 16px; line-height: 1.5;\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\"><tr><td><table align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"600\" style=\"margin: 0 auto; background-color: #ffffff;\"><tr><td style=\"padding: 40px 0; text-align: center;\"><h1 style=\"margin-top: 0; color: #000000; font-size: 24px;\">Registration Confirmation</h1><p style=\"margin-bottom: 20px;\">Dear [Name],</p><p style=\"margin-bottom: 20px;\">Thank you for registering for our service. Your account has been successfully created.</p><p style=\"margin-bottom: 20px;\">Your username is: [Username]</p><p style=\"margin-bottom: 40px;\">To get started, please click on the following confirmation link:</p><a href=\"[Login Link]\" style=\"display: inline-block; padding: 10px 20px; background-color: #0070c0; color: #ffffff; text-decoration: none;\">Confirm</a><p style=\"margin-top: 40px;\">Jingga e.K. - www.jingga.app - CEO Dennis Eichhorn</p></td></tr></table></td></tr></table></body></html>",
"bodyalt": "Dear [Name],\n\nThank you for registering for our service. Your account has been successfully created.\n\nYour username is: [Username]\n\nTo get started, please click on the following confirmation link: [Login Link].\n\n\nJingga e.K. - www.jingga.app - CEO Dennis Eichhorn"
},
"de": {
"subject": "Failed login",
"body": "<!DOCTYPE html><html><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title>Registration Confirmation</title></head><body style=\"font-family: Arial, sans-serif; font-size: 16px; line-height: 1.5;\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\"><tr><td><table align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"600\" style=\"margin: 0 auto; background-color: #ffffff;\"><tr><td style=\"padding: 40px 0; text-align: center;\"><h1 style=\"margin-top: 0; color: #000000; font-size: 24px;\">Registration Confirmation</h1><p style=\"margin-bottom: 20px;\">Dear [Name],</p><p style=\"margin-bottom: 20px;\">Thank you for registering for our service. Your account has been successfully created.</p><p style=\"margin-bottom: 20px;\">Your username is: [Username]</p><p style=\"margin-bottom: 40px;\">To get started, please click on the following confirmation link:</p><a href=\"[Login Link]\" style=\"display: inline-block; padding: 10px 20px; background-color: #0070c0; color: #ffffff; text-decoration: none;\">Confirm</a><p style=\"margin-top: 40px;\">Jingga e.K. - www.jingga.app - CEO Dennis Eichhorn</p></td></tr></table></td></tr></table></body></html>",
"bodyalt": "Dear [Name],\n\nThank you for registering for our service. Your account has been successfully created.\n\nYour username is: [Username]\n\nTo get started, please click on the following confirmation link: [Login Link].\n\n\nJingga e.K. - www.jingga.app - CEO Dennis Eichhorn"
}
},
"send": false
}
]

View File

@ -1473,6 +1473,11 @@
"null": true,
"foreignTable": "account",
"foreignKey": "account_id"
},
"settings_encrypted": {
"name": "settings_encrypted",
"type": "TINYINT(1)",
"null": false
}
}
},

View File

@ -146,6 +146,7 @@ return [
'name' => SettingsEnum::MAIL_SERVER_PASS,
'content' => '',
'module' => 'Admin',
'encrypted' => true,
],
[
'type' => 'setting',
@ -158,12 +159,14 @@ return [
'name' => SettingsEnum::MAIL_SERVER_KEY,
'content' => '',
'module' => 'Admin',
'encrypted' => true,
],
[
'type' => 'setting',
'name' => SettingsEnum::MAIL_SERVER_KEYPASS,
'content' => '',
'module' => 'Admin',
'encrypted' => true,
],
[
'type' => 'setting',

View File

@ -304,6 +304,7 @@ final class Installer extends InstallerAbstract
$request->setData('module', $data['module'] ?? null);
$request->setData('group', $data['group'] ?? null);
$request->setData('account', $data['account'] ?? null);
$request->setData('encrypted', $data['encrypted'] ?? false);
$module->apiSettingsCreate($request, $response);

View File

@ -64,7 +64,7 @@ echo $this->getData('nav')->render();
<label for="iOname"><?= $this->getHtml('OrganizationName'); ?></label>
<select id="iOname" name="settings_1000000009">
<?php $unit = UnitMapper::get()->where('id', 1)->execute(); ?>
<option value="<?= $unit->getId(); ?>"><?= $this->printHtml($unit->name); ?>
<option value="<?= $unit->id; ?>"><?= $this->printHtml($unit->name); ?>
</select>
</div>
</div>
@ -790,14 +790,14 @@ echo $this->getData('nav')->render();
</label>
<tbody>
<?php $count = 0;
$previousSettings = empty($settings) ? 'admin/settings/general' : 'admin/settings/general?{?}&sid=' . \reset($settings)->getId() . '&ptype=p';
$nextSettings = empty($settings) ? 'admin/settings/general' : 'admin/settings/general?{?}&sid=' . \end($settings)->getId() . '&ptype=n';
$previousSettings = empty($settings) ? 'admin/settings/general' : 'admin/settings/general?{?}&sid=' . \reset($settings)->id . '&ptype=p';
$nextSettings = empty($settings) ? 'admin/settings/general' : 'admin/settings/general?{?}&sid=' . \end($settings)->id . '&ptype=n';
foreach ($settings as $key => $setting) : ++$count;
?>
<tr tabindex="0">
<td><i class="fa fa-cogs"></i>
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><?= $setting->getId(); ?>
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><?= $setting->id; ?>
<td data-label="<?= $this->getHtml('Name'); ?>">
<?php
$name = $setting->name;

View File

@ -36,7 +36,6 @@ use Modules\Admin\Models\Module;
use Modules\Admin\Models\ModuleMapper;
use Modules\Admin\Models\ModuleStatusUpdateType;
use Modules\Admin\Models\NullAccount;
use Modules\Admin\Models\NullDataChange;
use Modules\Admin\Models\PermissionCategory;
use Modules\Admin\Models\SettingsEnum;
use Modules\Media\Models\Collection;
@ -71,6 +70,7 @@ use phpOMS\Model\Message\FormValidation;
use phpOMS\Model\Message\Reload;
use phpOMS\Module\ModuleInfo;
use phpOMS\Module\ModuleStatus;
use phpOMS\Security\EncryptionHelper;
use phpOMS\System\File\Local\File;
use phpOMS\System\MimeType;
use phpOMS\System\OperatingSystem;
@ -238,7 +238,9 @@ final class ApiController extends Controller
$handler->host = $emailSettings[SettingsEnum::MAIL_SERVER_OUT]->content ?? 'localhost';
$handler->hostname = $emailSettings[SettingsEnum::MAIL_SERVER_OUT]->content ?? '';
$handler->username = $emailSettings[SettingsEnum::MAIL_SERVER_USER]->content ?? '';
$handler->password = $emailSettings[SettingsEnum::MAIL_SERVER_PASS]->content ?? '';
$handler->password = $emailSettings[SettingsEnum::MAIL_SERVER_PASS]->isEncrypted && !empty($_SERVER['OMS_PRIVATE_KEY_I'] ?? '')
? EncryptionHelper::decryptShared($emailSettings[SettingsEnum::MAIL_SERVER_PASS]->content ?? '', $_SERVER['OMS_PRIVATE_KEY_I'])
: $emailSettings[SettingsEnum::MAIL_SERVER_PASS]->content ?? '';
return $handler;
}
@ -267,7 +269,7 @@ final class ApiController extends Controller
$forgotten = $this->app->appSettings->get(
names: [SettingsEnum::LOGIN_FORGOTTEN_DATE, SettingsEnum::LOGIN_FORGOTTEN_COUNT],
module: 'Admin',
account: $account->getId()
account: $account->id
);
$emailSettings = $this->app->appSettings->get(
@ -287,7 +289,7 @@ final class ApiController extends Controller
$token = (string) \random_bytes(64);
$handler = $this->setUpServerMailHandler();
$resetLink = UriFactory::build('{/base}/reset?user=' . $account->getId() . '&token=' . $token);
$resetLink = UriFactory::build('{/base}/reset?user=' . $account->id . '&token=' . $token);
$mail = new Email();
$mail->setFrom($emailSettings->content);
@ -300,19 +302,19 @@ final class ApiController extends Controller
[
'name' => SettingsEnum::LOGIN_FORGOTTEN_DATE,
'module' => self::NAME,
'account' => $account->getId(),
'account' => $account->id,
'content' => (string) \time(),
],
[
'name' => SettingsEnum::LOGIN_FORGOTTEN_COUNT,
'module' => self::NAME,
'account' => $account->getId(),
'account' => $account->id,
'content' => (string) (((int) $forgotten[SettingsEnum::LOGIN_FORGOTTEN_COUNT]->content) + 1),
],
[
'name' => SettingsEnum::LOGIN_FORGOTTEN_TOKEN,
'module' => self::NAME,
'account' => $account->getId(),
'account' => $account->id,
'content' => $token,
],
], true);
@ -415,13 +417,13 @@ final class ApiController extends Controller
[
'name' => SettingsEnum::LOGIN_FORGOTTEN_COUNT,
'module' => self::NAME,
'account' => $account->getId(),
'account' => $account->id,
'content' => '0',
],
[
'name' => SettingsEnum::LOGIN_FORGOTTEN_TOKEN,
'module' => self::NAME,
'account' => $account->getId(),
'account' => $account->id,
'content' => '',
],
], true);
@ -537,31 +539,59 @@ final class ApiController extends Controller
$unit = $data['unit'] ?? null;
$app = $data['app'] ?? null;
$module = $data['module'] ?? null;
$pattern = $data['pattern'] ?? '';
$encrypted = $data['encrypted'] ?? null;
$group = isset($data['group']) ? (int) $data['group'] : null;
$account = isset($data['account']) ? (int) $data['account'] : null;
/** @var \Model\Setting $old */
$old = $this->app->appSettings->get($id, $name, $unit, $app, $module, $group, $account);
if ($old->id === 0) {
$internalResponse = new HttpResponse();
$internalRequest = new HttpRequest($request->uri);
$internalRequest->header->account = $request->header->account;
$internalRequest->setData('id', $id);
$internalRequest->setData('name', $name);
$internalRequest->setData('content', $content);
$internalRequest->setData('pattern', $pattern);
$internalRequest->setData('unit', $unit);
$internalRequest->setData('app', $app);
$internalRequest->setData('module', $module);
$internalRequest->setData('group', $group);
$internalRequest->setData('account', $account);
$internalRequest->setData('encrypted', $encrypted);
$this->apiSettingsCreate($internalRequest, $internalResponse, $data);
continue;
}
$new = clone $old;
$new->name = $name ?? $new->name;
$new->content = $content ?? $new->content;
$new->isEncrypted = $encrypted ?? $new->isEncrypted;
$new->content = $new->isEncrypted && !empty($content) && !empty($_SERVER['OMS_PRIVATE_KEY_I'] ?? '')
? EncryptionHelper::encryptShared($content, $_SERVER['OMS_PRIVATE_KEY_I'])
: $content ?? $new->content;
$new->unit = $unit ?? $new->unit;
$new->app = $app ?? $new->app;
$new->module = $module ?? $new->module;
$new->group = $group ?? $new->group;
$new->account = $account ?? $new->account;
// @todo: this function call seems stupid, it should just pass the $new object.
$this->app->appSettings->set([
[
'id' => $new->getId(),
'id' => $new->id,
'name' => $new->name,
'content' => $new->content,
'unit' => $new->unit,
'app' => $new->app,
'module' => $new->module,
'group' => $new->group,
'account' => $new->account
'account' => $new->account,
'isEncrypted' => $new->isEncrypted,
]
], false);
@ -652,7 +682,8 @@ final class ApiController extends Controller
app: $request->getDataInt('app'),
module: $request->getDataString('module'),
group: $request->getDataInt('group'),
account: $request->getDataInt('account')
account: $request->getDataInt('account'),
isEncrypted: $request->getDataBool('encrypted') ?? false
);
return $setting;
@ -1009,8 +1040,8 @@ final class ApiController extends Controller
private function createDefaultAppSettings(App $app, RequestAbstract $request) : void
{
$settings = [];
$settings[] = new Setting(0, SettingsEnum::REGISTRATION_ALLOWED, '0', '\\d+', app: $app->getId(), module: 'Admin');
$settings[] = new Setting(0, SettingsEnum::APP_DEFAULT_GROUPS, '[]', app: $app->getId(), module: 'Admin');
$settings[] = new Setting(0, SettingsEnum::REGISTRATION_ALLOWED, '0', '\\d+', app: $app->id, module: 'Admin');
$settings[] = new Setting(0, SettingsEnum::APP_DEFAULT_GROUPS, '[]', app: $app->id, module: 'Admin');
foreach ($settings as $setting) {
$this->createModel($request->header->account, $setting, SettingMapper::class, 'setting', $request->getOrigin());
@ -1511,7 +1542,7 @@ final class ApiController extends Controller
$this->createProfileForAccount($account, $request);
}
$collection = $this->createMediaDirForAccount($account->getId(), $account->login ?? '', $request->header->account);
$collection = $this->createMediaDirForAccount($account->id, $account->login ?? '', $request->header->account);
$this->createModel($request->header->account, $collection, CollectionMapper::class, 'collection', $request->getOrigin());
// find default groups and create them
@ -1545,8 +1576,8 @@ final class ApiController extends Controller
if (!empty($defaultGroupIds)) {
$this->createModelRelation(
$account->getId(),
$account->getId(),
$account->id,
$account->id,
$defaultGroupIds,
AccountMapper::class,
'groups',
@ -1562,7 +1593,7 @@ final class ApiController extends Controller
$this->app->l11nManager->getText($response->getLanguage(), 'Admin', 'Api', 'AccountCreateTitle'),
\str_replace(
'{url}',
UriFactory::build('{/base}/admin/account/settings?{?}&id=' . $account->getId()),
UriFactory::build('{/base}/admin/account/settings?{?}&id=' . $account->id),
$this->app->l11nManager->getText($response->getLanguage(), 'Admin', 'Api', 'AccountCreateMsg'
)),
$account
@ -1668,7 +1699,7 @@ final class ApiController extends Controller
$account = null;
// email already in use
if (!($emailAccount instanceof NullAccount)
if ($emailAccount->id > 0
&& $emailAccount->login !== null
&& AccountMapper::login($emailAccount->login, (string) $request->getData('password')) !== LoginReturnType::OK
) {
@ -1686,13 +1717,13 @@ final class ApiController extends Controller
$response->header->status = RequestStatusCode::R_400;
return;
} elseif (!($emailAccount instanceof NullAccount)) {
} elseif ($emailAccount->id > 0) {
$account = $emailAccount;
}
// login already in use by different email
if ($account === null
&& !($loginAccount instanceof NullAccount)
&& $loginAccount->id > 0
&& $loginAccount->getEmail() !== $request->getData('email')
) {
$response->header->status = RequestStatusCode::R_400;
@ -1710,7 +1741,7 @@ final class ApiController extends Controller
return;
} elseif ($account === null
&& !($loginAccount instanceof NullAccount)
&& $loginAccount->id > 0
&& $loginAccount->login !== null
&& AccountMapper::login($loginAccount->login, (string) $request->getData('password')) !== LoginReturnType::OK
) {
@ -1722,7 +1753,7 @@ final class ApiController extends Controller
/** @var Account $account */
$account = AccountMapper::get()
->with('groups')
->where('id', $account->getId())
->where('id', $account->id)
->execute();
$defaultGroupIds = [];
@ -1788,8 +1819,8 @@ final class ApiController extends Controller
if (!empty($defaultGroupIds)) {
// Create missing account / group relationships
$this->createModelRelation(
$account->getId(),
$account->getId(),
$account->id,
$account->id,
$defaultGroupIds,
AccountMapper::class,
'groups',
@ -1823,7 +1854,7 @@ final class ApiController extends Controller
// Create confirmation pending entry
$dataChange = new DataChange();
$dataChange->type = 'account';
$dataChange->createdBy = $account->getId();
$dataChange->createdBy = $account->id;
$dataChange->data = \json_encode([
'status' => AccountStatus::ACTIVE
@ -1832,24 +1863,24 @@ final class ApiController extends Controller
$tries = 0;
do {
$dataChange->reHash();
$this->createModel($account->getId(), $dataChange, DataChangeMapper::class, 'datachange', $request->getOrigin());
$this->createModel($account->id, $dataChange, DataChangeMapper::class, 'datachange', $request->getOrigin());
++$tries;
} while ($dataChange->getId() === 0 && $tries < 5);
} while ($dataChange->id === 0 && $tries < 5);
}
// Create client
if ($request->hasData('client')) {
$client = $this->app->moduleManager->get('ClientManagement')
->findClientForAccount($account->getId(), $request->getDataInt('unit'));
->findClientForAccount($account->id, $request->getDataInt('unit'));
if ($client === null) {
$internalRequest = new HttpRequest();
$internalResponse = new HttpResponse();
$internalRequest->header->account = $account->getId();
$internalRequest->setData('account', $account->getId());
$internalRequest->setData('number', 100000 + $account->getId());
$internalRequest->header->account = $account->id;
$internalRequest->setData('account', $account->id);
$internalRequest->setData('number', 100000 + $account->id);
$internalRequest->setData('address', $request->getDataString('address') ?? '');
$internalRequest->setData('postal', $request->getDataString('postal') ?? '');
$internalRequest->setData('city', $request->getDataString('city') ?? '');
@ -1871,12 +1902,19 @@ final class ApiController extends Controller
/** @var \Modules\Messages\Models\Email $mail */
$mail = EmailMapper::get()
->with('l11n')
->where('id', (int) $emailSettings[SettingsEnum::LOGIN_MAIL_REGISTRATION_TEMPLATE])
->where('l11n/language', $response->getLanguage())
->execute();
$mail->setFrom($emailSettings[SettingsEnum::MAIL_SERVER_ADDR]->content);
$mail->addTo((string) $request->getData('email'));
// @todo: load default l11n if no translation is available
$mailL11n = $mail->getL11nByLanguage($response->getLanguage());
$mail->subject = $mailL11n->subject;
// @todo: improve, the /tld link could be api.myurl.com which of course is not the url of the respective app.
// Maybe store the uri in the $app model? or store all urls in the config file
$mail->body = \str_replace(
@ -1890,7 +1928,7 @@ final class ApiController extends Controller
: UriFactory::build('{/tld}/{/lang}/' . \strtolower($app->name) . '/signup/confirmation?hash=' . $dataChange->getHash()),
$account->login
],
$mail->body
$mailL11n->body
);
$mail->bodyAlt = \str_replace(
@ -1904,7 +1942,7 @@ final class ApiController extends Controller
: UriFactory::build('{/tld}/{/lang}/' . \strtolower($app->name) . '/signup/confirmation?hash=' . $dataChange->getHash()),
$account->login
],
$mail->bodyAlt
$mailL11n->bodyAlt
);
$handler->send($mail);
@ -1968,7 +2006,7 @@ final class ApiController extends Controller
/** @var DataChange $dataChange */
$dataChange = DataChangeMapper::get()->where('hash', (string) $request->getData('hash'))->execute();
if ($dataChange instanceof NullDataChange) {
if ($dataChange->id === 0) {
$response->header->status = RequestStatusCode::R_400;
return;
@ -3062,53 +3100,6 @@ final class ApiController extends Controller
{
}
/**
* Api method to forward an event to the cli app
*
* @param mixed ...$data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function cliEventCall(mixed ...$data) : void
{
/** @var \Model\Setting $setting */
$setting = $this->app->appSettings->get(null, SettingsEnum::CLI_ACTIVE);
$cliEventHandling = (bool) ($setting->content ?? false);
if ($cliEventHandling) {
$count = \count($data);
/** @var string $cliPath */
$cliPath = \realpath(__DIR__ . '/../../../cli.php');
if ($cliPath === false) {
return;
}
$jsonData = \json_encode($data);
if ($jsonData === false) {
$jsonData = '{}';
}
SystemUtils::runProc(
OperatingSystem::getSystem() === SystemType::WIN ? 'php.exe' : 'php',
\escapeshellarg($cliPath)
. ' /admin/event '
. '-g ' . \escapeshellarg($data[$count - 2] ?? '') . ' '
. '-i ' . \escapeshellarg($data[$count - 1] ?? '') . ' '
. '-d ' . \escapeshellarg($jsonData),
true
);
} else {
if ($this->app->moduleManager->isActive('Workflow')) {
$this->app->moduleManager->get('Workflow')->runWorkflowFromHook($data);
}
}
}
/**
* Routing end-point for application behaviour.
*
@ -3138,7 +3129,7 @@ final class ApiController extends Controller
$this->createModelRelation(
$request->header->account,
(int) $request->getData('account'),
$contact->getId(),
$contact->id,
AccountMapper::class, 'contacts', '', $request->getOrigin()
);

View File

@ -14,7 +14,6 @@ declare(strict_types=1);
namespace Modules\Admin\Controller;
use Model\NullSetting;
use Model\SettingMapper;
use Modules\Admin\Models\AccountMapper;
use Modules\Admin\Models\AccountPermissionMapper;
@ -28,7 +27,6 @@ use phpOMS\Asset\AssetType;
use phpOMS\Autoloader;
use phpOMS\Contract\RenderableInterface;
use phpOMS\DataStorage\Database\Query\OrderType;
use phpOMS\Localization\NullLocalization;
use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract;
use phpOMS\Utils\Parser\Markdown\Markdown;
@ -207,7 +205,7 @@ final class BackendController extends Controller
/** @var \Modules\Admin\Models\Account $account */
$account = AccountMapper::get()->with('groups')->with('l11n')->where('id', (int) $request->getData('id'))->execute();
if ($account->l11n instanceof NullLocalization) {
if ($account->l11n->id === 0) {
$account->l11n->loadFromLanguage($request->getLanguage());
}
@ -700,7 +698,7 @@ final class BackendController extends Controller
/** @var null|\Model\NullSetting|\Model\Setting[] $settings */
$settings = SettingMapper::getAll()->where('module', $id)->execute();
if (!($settings instanceof NullSetting)) {
if ($settings->id > 0) {
$view->setData('settings', !\is_array($settings) ? [$settings] : $settings);
}

View File

@ -64,7 +64,7 @@ class Account extends \phpOMS\Account\Account
* @var Location[]
* @since 1.0.0
*/
protected array $locations = [];
public array $locations = [];
/**
* Contact data.
@ -72,57 +72,5 @@ class Account extends \phpOMS\Account\Account
* @var Contact[]
* @since 1.0.0
*/
protected array $contacts = [];
/**
* Get account locations.
*
* @return Location[]
*
* @since 1.0.0
*/
public function getLocations() : array
{
return $this->locations;
}
/**
* Add location.
*
* @param Location $location Location
*
* @return void
*
* @since 1.0.0
*/
public function addLocation(Location $location) : void
{
$this->locations[] = $location;
}
/**
* Get account contact element.
*
* @return Contact[]
*
* @since 1.0.0
*/
public function getContacts() : array
{
return $this->contacts;
}
/**
* Add contact element.
*
* @param Contact $contact Contact Element
*
* @return void
*
* @since 1.0.0
*/
public function addContact(Contact $contact) : void
{
$this->contacts[] = $contact;
}
public array $contacts = [];
}

View File

@ -30,7 +30,7 @@ class AccountExternal
* @var int
* @since 1.0.0
*/
protected int $id = 0;
public int $id = 0;
/**
* External type.
@ -38,7 +38,7 @@ class AccountExternal
* @var int
* @since 1.0.0
*/
private int $type = AccountExternalType::PAYMENT;
public int $type = AccountExternalType::PAYMENT;
/**
* External subtype.
@ -54,7 +54,7 @@ class AccountExternal
* @var int
* @since 1.0.0
*/
private int $status = AccountExternalStatus::ACTIVATE;
public int $status = AccountExternalStatus::ACTIVATE;
/**
* External key

View File

@ -73,6 +73,12 @@ class AccountMapper extends DataMapperFactory
* @since 1.0.0
*/
public const HAS_MANY = [
'permissions' => [
'mapper' => AccountPermissionMapper::class,
'table' => 'account_permission',
'external' => null,
'self' => 'account_permission_account',
],
'groups' => [
'mapper' => GroupMapper::class,
'table' => 'account_group',
@ -142,38 +148,20 @@ class AccountMapper extends DataMapperFactory
*/
public static function getWithPermissions(int $id) : Account
{
if ($id < 1) {
return new NullAccount();
}
/** @var \Modules\Admin\Models\Account $account */
$account = self::get()
->with('groups')
->with('groups/permissions')
->with('permissions')
->with('l11n')
->where('id', $id)
->where('permission/element', null)
->execute();
$groups = \array_keys($account->getGroups());
/** @var \Modules\Admin\Models\GroupPermission[] $groupPermissions */
$groupPermissions = empty($groups)
? []
: GroupPermissionMapper::getAll()
->where('group', \array_keys($account->getGroups()), 'in')
->where('element', null)
->execute();
foreach ($groupPermissions as $permission) {
$account->addPermission($permission);
}
/** @var \Modules\Admin\Models\AccountPermission[] $accountPermissions */
$accountPermissions = AccountPermissionMapper::getAll()
->where('account', $id)
->where('element', null)
->execute();
foreach ($accountPermissions as $permission) {
$account->addPermission($permission);
}
return $account;
}

View File

@ -35,7 +35,7 @@ class AccountPermission extends PermissionAbstract
* @var int
* @since 1.0.0
*/
private int $account = 0;
public int $account = 0;
/**
* Constructor.

View File

@ -32,7 +32,7 @@ class ApiKey
* @var int
* @since 1.0.0
*/
protected int $id = 0;
public int $id = 0;
/**
* Names.
@ -48,7 +48,7 @@ class ApiKey
* @var int
* @since 1.0.0
*/
protected int $status = AccountStatus::INACTIVE;
public int $status = AccountStatus::INACTIVE;
/**
* Creator.

View File

@ -33,7 +33,7 @@ class App implements \JsonSerializable
* @var int
* @since 1.0.0
*/
protected int $id = 0;
public int $id = 0;
/**
* Name

View File

@ -32,7 +32,7 @@ class Contact
* @var int
* @since 1.0.0
*/
protected int $id = 0;
public int $id = 0;
/**
* Contact element type.
@ -40,7 +40,7 @@ class Contact
* @var int
* @since 1.0.0
*/
private int $type = ContactType::EMAIL;
public int $type = ContactType::EMAIL;
/**
* Contact element subtype.

View File

@ -30,7 +30,7 @@ class DataChange
* @var int
* @since 1.0.0
*/
protected int $id = 0;
public int $id = 0;
/**
* Hash

View File

@ -54,7 +54,7 @@ class Group extends \phpOMS\Account\Group
* @var Account[]
* @since 1.0.0
*/
protected array $accounts = [];
public array $accounts = [];
/**
* Constructor

View File

@ -35,7 +35,7 @@ class GroupPermission extends PermissionAbstract
* @var int
* @since 1.0.0
*/
private int $group = 0;
public int $group = 0;
/**
* Constructor.

View File

@ -73,7 +73,7 @@ class Module
* @var int
* @since 1.0.0
*/
protected int $status = ModuleStatus::INACTIVE;
public int $status = ModuleStatus::INACTIVE;
/**
* Created at.

View File

@ -50,7 +50,7 @@ final class PermissionQueryBuilder
*
* @var int
*/
private int $account = 0;
public int $account = 0;
/**
* Unit ids.

View File

@ -25,8 +25,7 @@ use phpOMS\Stdlib\Base\Enum;
* @since 1.0.0
*/
abstract class SettingsEnum extends Enum
{
/* Logging settings */
{ /* Logging settings */
public const PASSWORD_PATTERN = '1000000001';
public const LOGIN_TIMEOUT = '1000000002';

View File

@ -44,7 +44,7 @@ class GroupTagSelectorView extends View
* @var bool
* @since 1.0.0
*/
private bool $isRequired = false;
public bool $isRequired = false;
/**
* {@inheritdoc}

View File

@ -2,10 +2,10 @@
<div class="ipt-wrap">
<div class="ipt-first">
<span class="input">
<button type="button" id="<?= $this->getId(); ?>-book-button" data-action='[
<button type="button" id="<?= $this->id; ?>-book-button" data-action='[
{
"key": 1, "listener": "click", "action": [
{"key": 1, "type": "dom.popup", "selector": "#group-selector-tpl", "aniIn": "fadeIn", "id": "<?= $this->getId(); ?>"},
{"key": 1, "type": "dom.popup", "selector": "#group-selector-tpl", "aniIn": "fadeIn", "id": "<?= $this->id; ?>"},
{"key": 2, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/base}/admin/group?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
{"key": 3, "type": "dom.table.append", "id": "acc-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name/0"}, "position": -1},
{"key": 4, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/base}/admin/group?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
@ -13,37 +13,37 @@
]
}
]'><i class="fa fa-book"></i></button>
<input type="text" list="<?= $this->getId(); ?>-datalist" id="<?= $this->getId(); ?>" name="receiver" placeholder="&#xf007; Guest" data-action='[
<input type="text" list="<?= $this->id; ?>-datalist" id="<?= $this->id; ?>" name="receiver" placeholder="&#xf007; Guest" data-action='[
{
"key": 1, "listener": "keyup", "action": [
{"key": 1, "type": "validate.keypress", "pressed": "!13!37!38!39!40"},
{"key": 2, "type": "utils.timer", "id": "<?= $this->getId(); ?>", "delay": 500, "resets": true},
{"key": 3, "type": "dom.datalist.clear", "id": "<?= $this->getId(); ?>-datalist"},
{"key": 4, "type": "message.request", "uri": "{/base}/{/lang}/api/admin/find/group?search={!#<?= $this->getId(); ?>}", "method": "GET", "request_type": "json"},
{"key": 5, "type": "dom.datalist.append", "id": "<?= $this->getId(); ?>-datalist", "value": "id", "text": "name"}
{"key": 2, "type": "utils.timer", "id": "<?= $this->id; ?>", "delay": 500, "resets": true},
{"key": 3, "type": "dom.datalist.clear", "id": "<?= $this->id; ?>-datalist"},
{"key": 4, "type": "message.request", "uri": "{/base}/{/lang}/api/admin/find/group?search={!#<?= $this->id; ?>}", "method": "GET", "request_type": "json"},
{"key": 5, "type": "dom.datalist.append", "id": "<?= $this->id; ?>-datalist", "value": "id", "text": "name"}
]
},
{
"key": 2, "listener": "keydown", "action" : [
{"key": 1, "type": "validate.keypress", "pressed": "13|9"},
{"key": 2, "type": "message.request", "uri": "{/base}/{/lang}/api/admin/find/group?search={!#<?= $this->getId(); ?>}", "method": "GET", "request_type": "json"},
{"key": 3, "type": "dom.setvalue", "overwrite": true, "selector": "#<?= $this->getId(); ?>-idlist", "value": "{0/id}", "data": ""},
{"key": 4, "type": "dom.setvalue", "overwrite": true, "selector": "#<?= $this->getId(); ?>-taglist", "value": "<span id=\"<?= $this->getId(); ?>-taglist-{0/id}\" class=\"tag red\" data-id=\"{0/id}\"><i class=\"fa fa-times\"></i> {0/name}</span>", "data": ""},
{"key": 5, "type": "dom.setvalue", "overwrite": true, "selector": "#<?= $this->getId(); ?>", "value": "", "data": ""}
{"key": 2, "type": "message.request", "uri": "{/base}/{/lang}/api/admin/find/group?search={!#<?= $this->id; ?>}", "method": "GET", "request_type": "json"},
{"key": 3, "type": "dom.setvalue", "overwrite": true, "selector": "#<?= $this->id; ?>-idlist", "value": "{0/id}", "data": ""},
{"key": 4, "type": "dom.setvalue", "overwrite": true, "selector": "#<?= $this->id; ?>-taglist", "value": "<span id=\"<?= $this->id; ?>-taglist-{0/id}\" class=\"tag red\" data-id=\"{0/id}\"><i class=\"fa fa-times\"></i> {0/name}</span>", "data": ""},
{"key": 5, "type": "dom.setvalue", "overwrite": true, "selector": "#<?= $this->id; ?>", "value": "", "data": ""}
]
}
]'>
<datalist id="<?= $this->getId(); ?>-datalist"></datalist>
<input name="datalist-list" type="hidden" id="<?= $this->getId(); ?>-idlist"<?= $this->isRequired() ? ' required' : ''; ?>>
<datalist id="<?= $this->id; ?>-datalist"></datalist>
<input name="datalist-list" type="hidden" id="<?= $this->id; ?>-idlist"<?= $this->isRequired() ? ' required' : ''; ?>>
</span>
</div>
<div class="ipt-second"><button><?= $this->getHtml('Add', '0', '0'); ?></button></div>
</div>
<div class="box taglist" id="<?= $this->getId(); ?>-taglist" data-action='[
<div class="box taglist" id="<?= $this->id; ?>-taglist" data-action='[
{
"key": 1, "listener": "click", "selector": "#<?= $this->getId(); ?>-taglist span fa", "action": [
"key": 1, "listener": "click", "selector": "#<?= $this->id; ?>-taglist span fa", "action": [
{"key": 1, "type": "dom.getvalue", "base": "self"},
{"key": 2, "type": "dom.removevalue", "selector": "#<?= $this->getId(); ?>-idlist", "data": ""},
{"key": 2, "type": "dom.removevalue", "selector": "#<?= $this->id; ?>-idlist", "data": ""},
{"key": 3, "type": "dom.remove", "base": "self"}
]
}

View File

@ -86,7 +86,7 @@ echo $this->getData('nav')->render(); ?>
<?php
$c = 0;
foreach ($accounts as $key => $value) : ++$c;
$url = UriFactory::build('{/base}/admin/account/settings?{?}&id=' . $value->getId());
$url = UriFactory::build('{/base}/admin/account/settings?{?}&id=' . $value->id);
$color = 'darkred';
if ($value->getStatus() === AccountStatus::ACTIVE) { $color = 'green'; }
@ -95,7 +95,7 @@ echo $this->getData('nav')->render(); ?>
elseif ($value->getStatus() === AccountStatus::BANNED) { $color = 'red'; }
?>
<tr tabindex="0" data-href="<?= $url; ?>">
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $value->id; ?></a>
<td data-label="<?= $this->getHtml('Status'); ?>"><a href="<?= $url; ?>"><span class="tag <?= $color; ?>"><?= $this->getHtml('Status'. $value->getStatus()); ?></span></a>
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($this->renderUserName('%3$s %2$s %1$s', [$value->name1, $value->name2, $value->name3, $value->login])); ?></a>
<td data-label="<?= $this->getHtml('Activity'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->getLastActive()->format('Y-m-d H:i:s')); ?></a>

View File

@ -42,10 +42,10 @@ $l11n = $account->l11n;
$previous = empty($audits)
? HttpHeader::getAllHeaders()['Referer'] ?? 'admin/account/settings?id={?id}#{\#}'
: 'admin/account/settings?{?}&audit=' . \reset($audits)->getId() . '&ptype=p#{\#}';
: 'admin/account/settings?{?}&audit=' . \reset($audits)->id . '&ptype=p#{\#}';
$next = empty($audits)
? HttpHeader::getAllHeaders()['Referer'] ?? 'admin/account/settings?id={?id}#{\#}'
: 'admin/account/settings?{?}&audit=' . \end($audits)->getId() . '&ptype=n#{\#}';
: 'admin/account/settings?{?}&audit=' . \end($audits)->id . '&ptype=n#{\#}';
echo $this->getData('nav')->render(); ?>
@ -70,7 +70,7 @@ echo $this->getData('nav')->render(); ?>
<div class="portlet-body">
<div class="form-group">
<label for="iId"><?= $this->getHtml('ID', '0', '0'); ?></label>
<input id="iId" name="iaccount-idlist" type="text" value="<?= $account->getId(); ?>" disabled>
<input id="iId" name="iaccount-idlist" type="text" value="<?= $account->id; ?>" disabled>
</div>
<div class="form-group">
<label for="iType"><?= $this->getHtml('Type'); ?></label>
@ -169,7 +169,7 @@ echo $this->getData('nav')->render(); ?>
</div>
</div>
<div class="portlet-foot">
<input name="account" type="hidden" value="<?= $account->getId(); ?>">
<input name="account" type="hidden" value="<?= $account->id; ?>">
<input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</div>
</form>
@ -190,11 +190,11 @@ echo $this->getData('nav')->render(); ?>
$c = 0;
$groups = $account->getGroups();
foreach ($groups as $key => $value) : ++$c;
$url = UriFactory::build('{/base}/admin/group/settings?{?}&id=' . $value->getId());
$url = UriFactory::build('{/base}/admin/group/settings?{?}&id=' . $value->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="#"><i class="fa fa-times"></i></a>
<td><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
<td><a href="<?= $url; ?>"><?= $value->id; ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
<?php endforeach; ?>
<?php if ($c === 0) : ?>
@ -282,7 +282,7 @@ echo $this->getData('nav')->render(); ?>
</div>
</div>
<div class="portlet-foot">
<input type="hidden" name="permissionref" value="<?= $account->getId(); ?>">
<input type="hidden" name="permissionref" value="<?= $account->id; ?>">
<input type="hidden" name="permissionowner" value="<?= PermissionOwner::ACCOUNT; ?>">
<input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</div>
@ -317,7 +317,7 @@ echo $this->getData('nav')->render(); ?>
<tr>
<td><a href="#"><i class="fa fa-times"></i></a>
<td><a href="#"><i class="fa fa-cogs"></i></a>
<td><?= $value->getId(); ?>
<td><?= $value->id; ?>
<td><?= $value->getUnit(); ?>
<td><?= $value->getApp(); ?>
<td><?= $value->getModule(); ?>
@ -404,7 +404,7 @@ echo $this->getData('nav')->render(); ?>
</div>
</div>
<div class="portlet-foot">
<input type="hidden" name="account_id" value="<?= $account->getId(); ?>">
<input type="hidden" name="account_id" value="<?= $account->id; ?>">
<input id="iSubmitLocalization" name="submitLocalization" type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
</div>
</form>
@ -827,10 +827,10 @@ echo $this->getData('nav')->render(); ?>
<tbody>
<?php $count = 0;
foreach ($audits as $key => $audit) : ++$count;
$url = UriFactory::build('{/base}/admin/audit/single?{?}&id=' . $audit->getId());
$url = UriFactory::build('{/base}/admin/audit/single?{?}&id=' . $audit->id);
?>
<tr tabindex="0" data-href="<?= $url; ?>">
<td><?= $audit->getId(); ?>
<td><?= $audit->id; ?>
<td><?= $this->printHtml($audit->module); ?>
<td><?= $audit->type; ?>
<td><?= $this->printHtml($audit->trigger); ?>

View File

@ -85,7 +85,7 @@ echo $this->getData('nav')->render(); ?>
<tbody>
<?php $c = 0;
foreach ($groups as $key => $value) : ++$c;
$url = UriFactory::build('{/base}/admin/group/settings?{?}&id=' . $value->getId());
$url = UriFactory::build('{/base}/admin/group/settings?{?}&id=' . $value->id);
$color = 'darkred';
if ($value->getStatus() === GroupStatus::ACTIVE) { $color = 'green'; }
@ -93,10 +93,10 @@ echo $this->getData('nav')->render(); ?>
elseif ($value->getStatus() === GroupStatus::HIDDEN) { $color = 'purple'; }
?>
<tr tabindex="0" data-href="<?= $url; ?>">
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $value->id; ?></a>
<td data-label="<?= $this->getHtml('Status'); ?>"><a href="<?= $url; ?>"><span class="tag <?= $color; ?>"><?= $this->getHtml('Status'. $value->getStatus()); ?></span></a>
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
<td data-label="<?= $this->getHtml('Members'); ?>"><?= $memberCount[$value->getId()] ?? 0; ?>
<td data-label="<?= $this->getHtml('Members'); ?>"><?= $memberCount[$value->id] ?? 0; ?>
<?php endforeach; ?>
<?php if ($c === 0) : ?>
<tr><td colspan="5" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>

View File

@ -28,10 +28,10 @@ $audits = $this->getData('auditlogs') ?? [];
$previous = empty($audits)
? HttpHeader::getAllHeaders()['Referer'] ?? 'admin/group/settings?id={?id}#{\#}'
: 'admin/group/settings?{?}&audit=' . \reset($audits)->getId() . '&ptype=p#{\#}';
: 'admin/group/settings?{?}&audit=' . \reset($audits)->id . '&ptype=p#{\#}';
$next = empty($audits)
? HttpHeader::getAllHeaders()['Referer'] ?? 'admin/group/settings?id={?id}#{\#}'
: 'admin/group/settings?{?}&audit=' . \end($audits)->getId() . '&ptype=n#{\#}';
: 'admin/group/settings?{?}&audit=' . \end($audits)->id . '&ptype=n#{\#}';
echo $this->getData('nav')->render(); ?>
@ -55,7 +55,7 @@ echo $this->getData('nav')->render(); ?>
<div class="portlet-body">
<div class="form-group">
<label for="iGid"><?= $this->getHtml('ID', '0', '0'); ?></label>
<input id="iGid" name="id" type="text" value="<?= $group->getId(); ?>" disabled>
<input id="iGid" name="id" type="text" value="<?= $group->id; ?>" disabled>
</div>
<div class="form-group">
<label for="iGname"><?= $this->getHtml('Name'); ?></label>
@ -118,7 +118,7 @@ echo $this->getData('nav')->render(); ?>
<td><?= $this->getHtml('ID', '0', '0'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td class="wf-100"><?= $this->getHtml('Name'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<tbody>
<?php $c = 0; foreach ($accounts as $key => $value) : ++$c; $url = UriFactory::build('{/base}/admin/account/settings?{?}&id=' . $value->getId()); ?>
<?php $c = 0; foreach ($accounts as $key => $value) : ++$c; $url = UriFactory::build('{/base}/admin/account/settings?{?}&id=' . $value->id); ?>
<tr data-href="<?= $url; ?>">
<td><a href="#"><i class="fa fa-times"></i></a>
<td><a href="<?= $url; ?>"><?= $value->name1; ?> <?= $value->name2; ?></a>
@ -209,7 +209,7 @@ echo $this->getData('nav')->render(); ?>
</div>
</div>
<div class="portlet-foot">
<input type="hidden" name="permissionref" value="<?= $group->getId(); ?>">
<input type="hidden" name="permissionref" value="<?= $group->id; ?>">
<input type="hidden" name="permissionowner" value="<?= PermissionOwner::GROUP; ?>">
<input type="submit" class="cancel hidden" value="<?= $this->getHtml('Cancel', '0', '0'); ?>">
<input type="submit" class="update hidden" value="<?= $this->getHtml('Update', '0', '0'); ?>">
@ -268,7 +268,7 @@ echo $this->getData('nav')->render(); ?>
<tr>
<td><a href="#"><i class="fa fa-times"></i></a>
<td><i class="fa fa-cogs update btn"></i>
<td><?= $value->getId(); ?>
<td><?= $value->id; ?>
<td data-tpl-text="/unit" data-tpl-value="/unit"><?= $value->getUnit(); ?>
<td data-tpl-text="/app" data-tpl-value="/app"><?= $value->getApp(); ?>
<td data-tpl-text="/module" data-tpl-value="/module"><?= $value->getModule(); ?>
@ -320,11 +320,11 @@ echo $this->getData('nav')->render(); ?>
<td><?= $this->getHtml('Date', 'Auditor'); ?>
<tbody>
<?php $count = 0; foreach ($audits as $key => $audit) : ++$count;
$url = UriFactory::build('{/base}/admin/audit/single?{?}&id=' . $audit->getId()); ?>
$url = UriFactory::build('{/base}/admin/audit/single?{?}&id=' . $audit->id); ?>
<tr tabindex="0" data-href="<?= $url; ?>">
<td><?= $audit->getId(); ?>
<td><?= $audit->id; ?>
<td><?= $this->printHtml($audit->module); ?>
<td><?= $audit->getType(); ?>
<td><?= $audit->type; ?>
<td><?= $this->printHtml($audit->trigger); ?>
<td><?= $this->printHtml($audit->createdBy->login); ?>
<td><?= $this->printHtml($audit->ref); ?>

View File

@ -86,7 +86,7 @@ $tableView->setObjects($modules);
}
?>
<tr tabindex="0" data-href="<?= $url; ?>">
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $module->getId(); ?></a>
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $module->id; ?></a>
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($module->getExternalName()); ?></a>
<td data-label="<?= $this->getHtml('Version'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($module->getVersion()); ?></a>
<td data-label="<?= $this->getHtml('Status'); ?>">

View File

@ -20,8 +20,8 @@ use phpOMS\Uri\UriFactory;
*/
$audits = $this->getData('auditlogs') ?? [];
$previous = empty($audits) ? HttpHeader::getAllHeaders()['Referer'] ?? 'admin/module/settings?id={?id}#{\#}' : 'admin/module/settings?{?}&audit=' . \reset($audits)->getId() . '&ptype=p#{\#}';
$next = empty($audits) ? HttpHeader::getAllHeaders()['Referer'] ?? 'admin/module/settings?id={?id}#{\#}' : 'admin/module/settings?{?}&audit=' . \end($audits)->getId() . '&ptype=n#{\#}';
$previous = empty($audits) ? HttpHeader::getAllHeaders()['Referer'] ?? 'admin/module/settings?id={?id}#{\#}' : 'admin/module/settings?{?}&audit=' . \reset($audits)->id . '&ptype=p#{\#}';
$next = empty($audits) ? HttpHeader::getAllHeaders()['Referer'] ?? 'admin/module/settings?id={?id}#{\#}' : 'admin/module/settings?{?}&audit=' . \end($audits)->id . '&ptype=n#{\#}';
echo $this->getData('nav')->render();
?>
@ -54,9 +54,9 @@ echo $this->getData('nav')->render();
<td><?= $this->getHtml('Date', 'Auditor'); ?>
<tbody>
<?php $count = 0; foreach ($audits as $key => $audit) : ++$count;
$url = UriFactory::build('{/base}/admin/audit/single?{?}&id=' . $audit->getId()); ?>
$url = UriFactory::build('{/base}/admin/audit/single?{?}&id=' . $audit->id); ?>
<tr tabindex="0" data-href="<?= $url; ?>">
<td><?= $audit->getId(); ?>
<td><?= $audit->id; ?>
<td><?= $this->printHtml($audit->module); ?>
<td><?= $audit->type; ?>
<td><?= $this->printHtml($audit->trigger); ?>

View File

@ -112,7 +112,7 @@ else : ?>
?>
<tr tabindex="0">
<td><i class="fa fa-cogs"></i>
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><?= $setting->getId(); ?>
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><?= $setting->id; ?>
<td data-label="<?= $this->getHtml('Name'); ?>">
<?php
$name = $setting->name;

View File

@ -21,8 +21,8 @@ use phpOMS\Uri\UriFactory;
*/
$pages = $this->getData('pages') ?? [];
$previous = empty($pages) ? 'admin/page/list' : '{/base}/admin/page/list?{?}&id=' . \reset($pages)->getId() . '&ptype=p';
$next = empty($pages) ? 'admin/page/list' : '{/base}/admin/page/list?{?}&id=' . \end($pages)->getId() . '&ptype=n';
$previous = empty($pages) ? 'admin/page/list' : '{/base}/admin/page/list?{?}&id=' . \reset($pages)->id . '&ptype=p';
$next = empty($pages) ? 'admin/page/list' : '{/base}/admin/page/list?{?}&id=' . \end($pages)->id . '&ptype=n';
echo $this->getData('nav')->render(); ?>
@ -90,14 +90,14 @@ echo $this->getData('nav')->render(); ?>
</label>
<tbody>
<?php $c = 0; foreach ($accounts as $key => $value) : ++$c;
$url = UriFactory::build('{/base}/admin/account/settings?{?}&id=' . $value->getId());
$url = UriFactory::build('{/base}/admin/account/settings?{?}&id=' . $value->id);
$color = 'darkred';
if ($value->getStatus() === AccountStatus::ACTIVE) { $color = 'green'; }
elseif ($value->getStatus() === AccountStatus::INACTIVE) { $color = 'darkblue'; }
elseif ($value->getStatus() === AccountStatus::TIMEOUT) { $color = 'purple'; }
elseif ($value->getStatus() === AccountStatus::BANNED) { $color = 'red'; } ?>
<tr tabindex="0" data-href="<?= $url; ?>">
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $value->id; ?></a>
<td data-label="<?= $this->getHtml('Status'); ?>"><a href="<?= $url; ?>"><span class="tag <?= $color; ?>"><?= $this->getHtml('Status'. $value->getStatus()); ?></span></a>
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($this->renderUserName('%3$s %2$s %1$s', [$value->name1, $value->name2, $value->name3, $value->login])); ?></a>
<td data-label="<?= $this->getHtml('Activity'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->getLastActive()->format('Y-m-d H:i:s')); ?></a>

View File

@ -62,7 +62,7 @@ $l11n = $this->getData('defaultlocalization') ?? new NullLocalization();
<label for="iOname"><?= $this->getHtml('OrganizationName'); ?></label>
<select id="iOname" name="settings_1000000009">
<?php $unit = UnitMapper::get()->where('id', (int) $generalSettings[1000000009])->execute(); ?>
<option value="<?= $unit->getId(); ?>"><?= $this->printHtml($unit->name); ?>
<option value="<?= $unit->id; ?>"><?= $this->printHtml($unit->name); ?>
</select>
</div>
</div>
@ -710,14 +710,14 @@ $l11n = $this->getData('defaultlocalization') ?? new NullLocalization();
</label>
<tbody>
<?php $count = 0;
$previousSettings = empty($settings) ? 'admin/settings/general' : 'admin/settings/general?{?}&sid=' . \reset($settings)->getId() . '&ptype=p';
$nextSettings = empty($settings) ? 'admin/settings/general' : 'admin/settings/general?{?}&sid=' . \end($settings)->getId() . '&ptype=n';
$previousSettings = empty($settings) ? 'admin/settings/general' : 'admin/settings/general?{?}&sid=' . \reset($settings)->id . '&ptype=p';
$nextSettings = empty($settings) ? 'admin/settings/general' : 'admin/settings/general?{?}&sid=' . \end($settings)->id . '&ptype=n';
foreach ($settings as $key => $setting) : ++$count;
?>
<tr tabindex="0">
<td><i class="fa fa-cogs"></i>
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><?= $setting->getId(); ?>
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><?= $setting->id; ?>
<td data-label="<?= $this->getHtml('Name'); ?>"><?= $this->printHtml($setting->name); ?>
<td data-label="<?= $this->getHtml('Value'); ?>"><?= $this->printHtml($setting->content); ?>
<td data-label="<?= $this->getHtml('Module'); ?>"><?= $this->printHtml($setting->module); ?>

View File

@ -39,7 +39,7 @@ trait ApiControllerAccountTrait
$this->module->apiAccountGet($request, $response);
self::assertEquals('admin', $response->get('')['response']->login);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
/**
@ -61,7 +61,7 @@ trait ApiControllerAccountTrait
$this->module->apiAccountGet($request, $response);
self::assertEquals('oms@karaka.de', $response->get('')['response']->getEmail());
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
/**
@ -103,7 +103,7 @@ trait ApiControllerAccountTrait
$this->module->apiAccountCreate($request, $response);
self::assertEquals('guest', $response->get('')['response']->login);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
/**
@ -127,7 +127,7 @@ trait ApiControllerAccountTrait
$this->module->apiAccountCreate($request, $response);
self::assertEquals('guest2', $response->get('')['response']->login);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
/**
@ -148,10 +148,10 @@ trait ApiControllerAccountTrait
$request->setData('status', AccountStatus::INACTIVE);
$this->module->apiAccountCreate($request, $response);
$request->setData('id', $response->get('')['response']->getId());
$request->setData('id', $response->get('')['response']->id);
$this->module->apiAccountDelete($request, $response);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
/**

View File

@ -38,7 +38,7 @@ trait ApiControllerGroupTrait
$this->module->apiGroupGet($request, $response);
self::assertEquals('admin', $response->get('')['response']->name);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
/**
@ -100,13 +100,13 @@ trait ApiControllerGroupTrait
$this->module->apiGroupCreate($request, $response);
self::assertEquals('test', $response->get('')['response']->name);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
// test delete
$request->setData('id', $response->get('')['response']->getId());
$request->setData('id', $response->get('')['response']->id);
$this->module->apiGroupDelete($request, $response);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
/**

View File

@ -39,7 +39,7 @@ trait ApiControllerPermissionTrait
$this->module->apiAddGroupPermission($request, $response);
self::assertEquals('ok', $response->get('')['status']);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
/**
@ -75,7 +75,7 @@ trait ApiControllerPermissionTrait
$this->module->apiGroupPermissionGet($request, $response);
self::assertGreaterThan(0, $response->get('')['response']->getGroup());
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
/**
@ -94,13 +94,13 @@ trait ApiControllerPermissionTrait
$this->module->apiAddGroupPermission($request, $response);
self::assertEquals('ok', $response->get('')['status']);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
// test delete
$request->setData('id', $response->get('')['response']->getId());
$request->setData('id', $response->get('')['response']->id);
$this->module->apiGroupPermissionDelete($request, $response);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
/**
@ -155,7 +155,7 @@ trait ApiControllerPermissionTrait
$this->module->apiGroupPermissionUpdate($request, $response);
self::assertEquals(PermissionType::READ, $response->get('')['response']->getPermission());
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
$request->setData('permissioncreate', PermissionType::CREATE);
$request->setData('permissionupdate', PermissionType::MODIFY);
@ -181,7 +181,7 @@ trait ApiControllerPermissionTrait
$this->module->apiAddAccountPermission($request, $response);
self::assertEquals('ok', $response->get('')['status']);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
/**
@ -200,7 +200,7 @@ trait ApiControllerPermissionTrait
$this->module->apiAccountPermissionGet($request, $response);
self::assertEquals(1, $response->get('')['response']->getAccount());
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
/**
@ -219,13 +219,13 @@ trait ApiControllerPermissionTrait
$this->module->apiAddAccountPermission($request, $response);
self::assertEquals('ok', $response->get('')['status']);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
// test delete
$request->setData('id', $response->get('')['response']->getId());
$request->setData('id', $response->get('')['response']->id);
$this->module->apiAccountPermissionDelete($request, $response);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
/**
@ -280,6 +280,6 @@ trait ApiControllerPermissionTrait
$this->module->apiAccountPermissionUpdate($request, $response);
self::assertEquals(PermissionType::READ, $response->get('')['response']->getPermission());
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
}

View File

@ -47,10 +47,10 @@ final class AccountMapperTest extends \PHPUnit\Framework\TestCase
$account->setType(AccountType::USER);
$id = AccountMapper::create()->execute($account);
self::assertGreaterThan(0, $account->getId());
self::assertEquals($id, $account->getId());
self::assertGreaterThan(0, $account->id);
self::assertEquals($id, $account->id);
$accountR = AccountMapper::get()->where('id', $account->getId())->execute();
$accountR = AccountMapper::get()->where('id', $account->id)->execute();
self::assertEquals($account->createdAt->format('Y-m-d'), $accountR->createdAt->format('Y-m-d'));
self::assertEquals($account->login, $accountR->login);
self::assertEquals($account->name1, $accountR->name1);

View File

@ -44,10 +44,10 @@ final class AddressMapperTest extends \PHPUnit\Framework\TestCase
$address->setGeo(['lat' => 12.1, 'long' => 11.2,]);
$id = AddressMapper::create()->execute($address);
self::assertGreaterThan(0, $address->getId());
self::assertEquals($id, $address->getId());
self::assertGreaterThan(0, $address->id);
self::assertEquals($id, $address->id);
$addressR = AddressMapper::get()->where('id', $address->getId())->execute();
$addressR = AddressMapper::get()->where('id', $address->id)->execute();
self::assertEquals($address->name, $addressR->name);
self::assertEquals($address->addition, $addressR->addition);
self::assertEquals($address->getType(), $addressR->getType());

View File

@ -39,10 +39,10 @@ final class AppMapperTest extends \PHPUnit\Framework\TestCase
$app->status = ApplicationStatus::NORMAL;
$id = AppMapper::create()->execute($app);
self::assertGreaterThan(0, $app->getId());
self::assertEquals($id, $app->getId());
self::assertGreaterThan(0, $app->id);
self::assertEquals($id, $app->id);
$appR = AppMapper::get()->where('id', $app->getId())->execute();
$appR = AppMapper::get()->where('id', $app->id)->execute();
self::assertEquals($app->name, $appR->name);
self::assertEquals($app->theme, $appR->theme);
self::assertEquals($app->status, $appR->status);

View File

@ -31,6 +31,6 @@ final class AppTest extends \PHPUnit\Framework\TestCase
public function testDefault() : void
{
$account = new App();
self::assertEquals(0, $account->getId());
self::assertEquals(0, $account->id);
}
}

View File

@ -42,7 +42,7 @@ final class GroupMapperTest extends \PHPUnit\Framework\TestCase
$permissions = GroupMapper::getPermissionForModule('Admin');
foreach ($permissions as $p) {
if ($p->getId() === $groupId) {
if ($p->id === $groupId) {
self::assertTrue(true);
return;
}

View File

@ -42,7 +42,7 @@ final class GroupTest extends \PHPUnit\Framework\TestCase
public function testDefault() : void
{
self::assertEquals((new \DateTime('now'))->format('Y-m-d'), $this->group->createdAt->format('Y-m-d'));
self::assertEquals(0, $this->group->createdBy->getId());
self::assertEquals(0, $this->group->createdBy->id);
self::assertEquals('', $this->group->descriptionRaw);
self::assertEquals([], $this->group->getAccounts());
}
@ -66,6 +66,6 @@ final class GroupTest extends \PHPUnit\Framework\TestCase
public function testCreatorInputOutput() : void
{
$this->group->createdBy = new NullAccount(3);
self::assertEquals(3, $this->group->createdBy->getId());
self::assertEquals(3, $this->group->createdBy->id);
}
}

View File

@ -41,7 +41,7 @@ final class ModuleTest extends \PHPUnit\Framework\TestCase
*/
public function testDefault() : void
{
self::assertEquals('', $this->module->getId());
self::assertEquals('', $this->module->id);
self::assertInstanceOf('\DateTimeImmutable', $this->module->createdAt);
self::assertEquals('', $this->module->name);
self::assertEquals(ModuleStatus::INACTIVE, $this->module->getStatus());

View File

@ -37,6 +37,6 @@ final class NullAccountPermissionTest extends \PHPUnit\Framework\TestCase
public function testId() : void
{
$null = new NullAccountPermission(2);
self::assertEquals(2, $null->getId());
self::assertEquals(2, $null->id);
}
}

View File

@ -37,6 +37,6 @@ final class NullAccountTest extends \PHPUnit\Framework\TestCase
public function testId() : void
{
$null = new NullAccount(2);
self::assertEquals(2, $null->getId());
self::assertEquals(2, $null->id);
}
}

View File

@ -37,6 +37,6 @@ final class NullAddressTest extends \PHPUnit\Framework\TestCase
public function testId() : void
{
$null = new NullAddress(2);
self::assertEquals(2, $null->getId());
self::assertEquals(2, $null->id);
}
}

View File

@ -37,6 +37,6 @@ final class NullGroupPermissionTest extends \PHPUnit\Framework\TestCase
public function testId() : void
{
$null = new NullGroupPermission(2);
self::assertEquals(2, $null->getId());
self::assertEquals(2, $null->id);
}
}

View File

@ -37,6 +37,6 @@ final class NullGroupTest extends \PHPUnit\Framework\TestCase
public function testId() : void
{
$null = new NullGroup(2);
self::assertEquals(2, $null->getId());
self::assertEquals(2, $null->id);
}
}

View File

@ -37,6 +37,6 @@ final class NullModuleTest extends \PHPUnit\Framework\TestCase
public function testId() : void
{
$null = new NullModule('Test');
self::assertEquals('Test', $null->getId());
self::assertEquals('Test', $null->id);
}
}