- = $setting->getId(); ?>
+ = $setting->id; ?>
name;
diff --git a/Controller/ApiController.php b/Controller/ApiController.php
index 057ca18..9693878 100755
--- a/Controller/ApiController.php
+++ b/Controller/ApiController.php
@@ -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()
);
diff --git a/Controller/BackendController.php b/Controller/BackendController.php
index c86dd8e..6661f6f 100755
--- a/Controller/BackendController.php
+++ b/Controller/BackendController.php
@@ -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);
}
diff --git a/Models/Account.php b/Models/Account.php
index 63f87b8..f503ce0 100755
--- a/Models/Account.php
+++ b/Models/Account.php
@@ -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 = [];
}
diff --git a/Models/AccountExternal.php b/Models/AccountExternal.php
index 8b31ae6..aaace80 100755
--- a/Models/AccountExternal.php
+++ b/Models/AccountExternal.php
@@ -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
diff --git a/Models/AccountMapper.php b/Models/AccountMapper.php
index 5707d4c..a10002d 100755
--- a/Models/AccountMapper.php
+++ b/Models/AccountMapper.php
@@ -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;
}
diff --git a/Models/AccountPermission.php b/Models/AccountPermission.php
index 4312725..649f4b7 100755
--- a/Models/AccountPermission.php
+++ b/Models/AccountPermission.php
@@ -35,7 +35,7 @@ class AccountPermission extends PermissionAbstract
* @var int
* @since 1.0.0
*/
- private int $account = 0;
+ public int $account = 0;
/**
* Constructor.
diff --git a/Models/ApiKey.php b/Models/ApiKey.php
index 50e99aa..6da5f3c 100755
--- a/Models/ApiKey.php
+++ b/Models/ApiKey.php
@@ -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.
diff --git a/Models/App.php b/Models/App.php
index e36780a..334c8e2 100755
--- a/Models/App.php
+++ b/Models/App.php
@@ -33,7 +33,7 @@ class App implements \JsonSerializable
* @var int
* @since 1.0.0
*/
- protected int $id = 0;
+ public int $id = 0;
/**
* Name
diff --git a/Models/Contact.php b/Models/Contact.php
index a8c1d23..d0b8522 100755
--- a/Models/Contact.php
+++ b/Models/Contact.php
@@ -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.
diff --git a/Models/DataChange.php b/Models/DataChange.php
index f5785f1..d34f0c9 100755
--- a/Models/DataChange.php
+++ b/Models/DataChange.php
@@ -30,7 +30,7 @@ class DataChange
* @var int
* @since 1.0.0
*/
- protected int $id = 0;
+ public int $id = 0;
/**
* Hash
diff --git a/Models/Group.php b/Models/Group.php
index a318d7c..b108842 100755
--- a/Models/Group.php
+++ b/Models/Group.php
@@ -54,7 +54,7 @@ class Group extends \phpOMS\Account\Group
* @var Account[]
* @since 1.0.0
*/
- protected array $accounts = [];
+ public array $accounts = [];
/**
* Constructor
diff --git a/Models/GroupPermission.php b/Models/GroupPermission.php
index 2b5ebe2..c31c76b 100755
--- a/Models/GroupPermission.php
+++ b/Models/GroupPermission.php
@@ -35,7 +35,7 @@ class GroupPermission extends PermissionAbstract
* @var int
* @since 1.0.0
*/
- private int $group = 0;
+ public int $group = 0;
/**
* Constructor.
diff --git a/Models/Module.php b/Models/Module.php
index 08a2390..27f8a07 100755
--- a/Models/Module.php
+++ b/Models/Module.php
@@ -73,7 +73,7 @@ class Module
* @var int
* @since 1.0.0
*/
- protected int $status = ModuleStatus::INACTIVE;
+ public int $status = ModuleStatus::INACTIVE;
/**
* Created at.
diff --git a/Models/PermissionQueryBuilder.php b/Models/PermissionQueryBuilder.php
index ff4aec5..3651057 100755
--- a/Models/PermissionQueryBuilder.php
+++ b/Models/PermissionQueryBuilder.php
@@ -50,7 +50,7 @@ final class PermissionQueryBuilder
*
* @var int
*/
- private int $account = 0;
+ public int $account = 0;
/**
* Unit ids.
diff --git a/Models/SettingsEnum.php b/Models/SettingsEnum.php
index c84a7fe..b553d94 100755
--- a/Models/SettingsEnum.php
+++ b/Models/SettingsEnum.php
@@ -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';
diff --git a/Theme/Backend/Components/GroupTagSelector/GroupTagSelectorView.php b/Theme/Backend/Components/GroupTagSelector/GroupTagSelectorView.php
index 0c47292..3a3eb22 100755
--- a/Theme/Backend/Components/GroupTagSelector/GroupTagSelectorView.php
+++ b/Theme/Backend/Components/GroupTagSelector/GroupTagSelectorView.php
@@ -44,7 +44,7 @@ class GroupTagSelectorView extends View
* @var bool
* @since 1.0.0
*/
- private bool $isRequired = false;
+ public bool $isRequired = false;
/**
* {@inheritdoc}
diff --git a/Theme/Backend/Components/GroupTagSelector/group-selector.tpl.php b/Theme/Backend/Components/GroupTagSelector/group-selector.tpl.php
index 0bbfe7b..0c29b94 100755
--- a/Theme/Backend/Components/GroupTagSelector/group-selector.tpl.php
+++ b/Theme/Backend/Components/GroupTagSelector/group-selector.tpl.php
@@ -2,10 +2,10 @@
- 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 @@
]
}
]'>
- 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": "getId(); ?>-taglist-{0/id}\" class=\"tag red\" data-id=\"{0/id}\"> {0/name} ", "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": "id; ?>-taglist-{0/id}\" class=\"tag red\" data-id=\"{0/id}\"> {0/name} ", "data": ""},
+ {"key": 5, "type": "dom.setvalue", "overwrite": true, "selector": "#= $this->id; ?>", "value": "", "data": ""}
]
}
]'>
-
- isRequired() ? ' required' : ''; ?>>
+
+ isRequired() ? ' required' : ''; ?>>
= $this->getHtml('Add', '0', '0'); ?>
- 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"}
]
}
diff --git a/Theme/Backend/accounts-list.tpl.php b/Theme/Backend/accounts-list.tpl.php
index d1acd8a..41a0489 100755
--- a/Theme/Backend/accounts-list.tpl.php
+++ b/Theme/Backend/accounts-list.tpl.php
@@ -86,7 +86,7 @@ echo $this->getData('nav')->render(); ?>
$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'; }
?>
- = $value->getId(); ?>
+ = $value->id; ?>
= $this->getHtml('Status'. $value->getStatus()); ?>
= $this->printHtml($this->renderUserName('%3$s %2$s %1$s', [$value->name1, $value->name2, $value->name3, $value->login])); ?>
= $this->printHtml($value->getLastActive()->format('Y-m-d H:i:s')); ?>
diff --git a/Theme/Backend/accounts-single.tpl.php b/Theme/Backend/accounts-single.tpl.php
index 7ec6f22..4e2826a 100755
--- a/Theme/Backend/accounts-single.tpl.php
+++ b/Theme/Backend/accounts-single.tpl.php
@@ -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(); ?>
@@ -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);
?>
- = $value->getId(); ?>
+ = $value->id; ?>
= $this->printHtml($value->name); ?>
@@ -282,7 +282,7 @@ echo $this->getData('nav')->render(); ?>
@@ -317,7 +317,7 @@ echo $this->getData('nav')->render(); ?>
- = $value->getId(); ?>
+ = $value->id; ?>
= $value->getUnit(); ?>
= $value->getApp(); ?>
= $value->getModule(); ?>
@@ -404,7 +404,7 @@ echo $this->getData('nav')->render(); ?>
@@ -827,10 +827,10 @@ echo $this->getData('nav')->render(); ?>
$audit) : ++$count;
- $url = UriFactory::build('{/base}/admin/audit/single?{?}&id=' . $audit->getId());
+ $url = UriFactory::build('{/base}/admin/audit/single?{?}&id=' . $audit->id);
?>
- = $audit->getId(); ?>
+ = $audit->id; ?>
= $this->printHtml($audit->module); ?>
= $audit->type; ?>
= $this->printHtml($audit->trigger); ?>
diff --git a/Theme/Backend/groups-list.tpl.php b/Theme/Backend/groups-list.tpl.php
index 0f9b297..0452785 100755
--- a/Theme/Backend/groups-list.tpl.php
+++ b/Theme/Backend/groups-list.tpl.php
@@ -85,7 +85,7 @@ echo $this->getData('nav')->render(); ?>
$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'; }
?>
- = $value->getId(); ?>
+ = $value->id; ?>
= $this->getHtml('Status'. $value->getStatus()); ?>
= $this->printHtml($value->name); ?>
- = $memberCount[$value->getId()] ?? 0; ?>
+ = $memberCount[$value->id] ?? 0; ?>
= $this->getHtml('Empty', '0', '0'); ?>
diff --git a/Theme/Backend/groups-single.tpl.php b/Theme/Backend/groups-single.tpl.php
index 0d12fa3..5e9b7ac 100755
--- a/Theme/Backend/groups-single.tpl.php
+++ b/Theme/Backend/groups-single.tpl.php
@@ -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(); ?>