Skip to content

Commit

Permalink
auto fixes + some impl.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis Eichhorn committed Jan 26, 2024
1 parent 2e3ce77 commit 35f5c85
Show file tree
Hide file tree
Showing 59 changed files with 1,363 additions and 699 deletions.
3 changes: 1 addition & 2 deletions Admin/Install/Messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use phpOMS\Application\ApplicationAbstract;
use phpOMS\Message\Http\HttpRequest;
use phpOMS\Message\Http\HttpResponse;
use phpOMS\Uri\HttpUri;

/**
* Media class.
Expand Down Expand Up @@ -75,7 +74,7 @@ public static function install(ApplicationAbstract $app, string $path) : void
];

$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();

$request->header->account = 1;
$request->setData('settings', \json_encode($settings));
Expand Down
92 changes: 63 additions & 29 deletions Admin/Install/db.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@
"type": "TINYINT(1)",
"null": false
},
"address_attr_type_internal": {
"name": "address_attr_type_internal",
"type": "TINYINT(1)",
"null": false
},
"address_attr_type_required": {
"description": "Every address must have this attribute type if set to true.",
"name": "address_attr_type_required",
Expand Down Expand Up @@ -871,6 +876,11 @@
"type": "TINYINT(1)",
"null": false
},
"unit_attr_type_internal": {
"name": "unit_attr_type_internal",
"type": "TINYINT(1)",
"null": false
},
"unit_attr_type_required": {
"description": "Every unit must have this attribute type if set to true.",
"name": "unit_attr_type_required",
Expand Down Expand Up @@ -1399,6 +1409,11 @@
"type": "TINYINT(1)",
"null": false
},
"account_attr_type_internal": {
"name": "account_attr_type_internal",
"type": "TINYINT(1)",
"null": false
},
"account_attr_type_required": {
"description": "Every account must have this attribute type if set to true.",
"name": "account_attr_type_required",
Expand Down Expand Up @@ -1656,50 +1671,35 @@
}
}
},
"account_contact": {
"name": "account_contact",
"contact": {
"name": "contact",
"fields": {
"account_contact_id": {
"name": "account_contact_id",
"contact_id": {
"name": "contact_id",
"type": "INT",
"null": false,
"primary": true,
"autoincrement": true
},
"account_contact_type": {
"name": "account_contact_type",
"type": "TINYINT",
"contact_title": {
"name": "contact_title",
"type": "VARCHAR(255)",
"null": false
},
"account_contact_subtype": {
"name": "account_contact_subtype",
"contact_type": {
"name": "contact_type",
"type": "TINYINT",
"null": false
},
"account_contact_order": {
"name": "account_contact_order",
"type": "INT",
"contact_subtype": {
"name": "contact_subtype",
"type": "TINYINT",
"null": false
},
"account_contact_content": {
"name": "account_contact_content",
"contact_content": {
"name": "contact_content",
"type": "VARCHAR(255)",
"null": false
},
"account_contact_module": {
"name": "account_contact_module",
"type": "VARCHAR(190)",
"null": true,
"default": null,
"foreignTable": "module",
"foreignKey": "module_id"
},
"account_contact_account": {
"name": "account_contact_account",
"type": "INT",
"null": false,
"foreignTable": "account",
"foreignKey": "account_id"
}
}
},
Expand Down Expand Up @@ -1737,6 +1737,40 @@
}
}
},
"account_contact_rel": {
"name": "account_contact_rel",
"fields": {
"account_contact_rel_id": {
"name": "account_contact_rel_id",
"type": "INT",
"null": false,
"primary": true,
"autoincrement": true
},
"account_contact_rel_account": {
"name": "account_contact_rel_account",
"type": "INT",
"null": false,
"foreignTable": "account",
"foreignKey": "account_id"
},
"account_contact_rel_module": {
"name": "account_contact_rel_module",
"type": "VARCHAR(190)",
"null": true,
"default": null,
"foreignTable": "module",
"foreignKey": "module_id"
},
"account_contact_rel_contact": {
"name": "account_contact_rel_contact",
"type": "INT",
"null": false,
"foreignTable": "contact",
"foreignKey": "contact_id"
}
}
},
"account_account_rel": {
"description": "Accounts can belong to other accounts. E.g. a user can belong to a company account",
"name": "account_account_rel",
Expand Down
5 changes: 2 additions & 3 deletions Admin/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
use phpOMS\System\File\PathException;
use phpOMS\System\OperatingSystem;
use phpOMS\System\SystemType;
use phpOMS\Uri\HttpUri;

/**
* Installer class.
Expand Down Expand Up @@ -287,13 +286,13 @@ public static function installExternal(ApplicationAbstract $app, array $data) :
*
* @since 1.0.0
*/
private static function createSettings(ApplicationAbstract $app, array $data) : array
public static function createSettings(ApplicationAbstract $app, array $data) : array
{
/** @var \Modules\Admin\Controller\ApiController $module */
$module = $app->moduleManager->get('Admin');

$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();

$request->header->account = 1;
$request->setData('id', $data['id'] ?? 0);
Expand Down
4 changes: 2 additions & 2 deletions Admin/Routes/Cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
'verb' => RouteVerb::ANY,
],
],
'^/admin/event.*$' => [
'^/admin/event(\?.*$|$)' => [
[
'dest' => '\Modules\Admin\Controller\CliController:cliRunEvent',
'verb' => RouteVerb::ANY,
],
],
'^/admin/encryption/change.*$' => [
'^/admin/encryption/change(\?.*$|$)' => [
[
'dest' => '\Modules\Admin\Controller\CliController:cliEncryptionChange',
'verb' => RouteVerb::ANY,
Expand Down
80 changes: 69 additions & 11 deletions Admin/Routes/Web/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
],
],
],
'^.*/admin/find/group.*$' => [
'^.*/admin/find/group(\?.*$|$)' => [
[
'dest' => '\Modules\Admin\Controller\ApiController:apiGroupFind',
'verb' => RouteVerb::GET,
Expand All @@ -164,7 +164,7 @@
],
],
],
'^.*/admin/find/accgrp.*$' => [
'^.*/admin/find/accgrp(\?.*$|$)' => [
[
'dest' => '\Modules\Admin\Controller\ApiController:apiAccountGroupFind',
'verb' => RouteVerb::GET,
Expand Down Expand Up @@ -226,7 +226,7 @@
],
],

'^.*/admin/module/status.*$' => [
'^.*/admin/module/status(\?.*$|$)' => [
[
'dest' => '\Modules\Admin\Controller\ApiController:apiModuleStatusUpdate',
'verb' => RouteVerb::SET,
Expand All @@ -238,7 +238,7 @@
],
],

'^.*/admin/group/account.*$' => [
'^.*/admin/group/account(\?.*$|$)' => [
[
'dest' => '\Modules\Admin\Controller\ApiController:apiAddAccountToGroup',
'verb' => RouteVerb::PUT,
Expand All @@ -249,7 +249,7 @@
],
],
],
'^.*/admin/account/group.*$' => [
'^.*/admin/account/group(\?.*$|$)' => [
[
'dest' => '\Modules\Admin\Controller\ApiController:apiAddGroupToAccount',
'verb' => RouteVerb::PUT,
Expand All @@ -261,7 +261,7 @@
],
],

'^.*/admin/group/permission.*$' => [
'^.*/admin/group/permission(\?.*$|$)' => [
[
'dest' => '\Modules\Admin\Controller\ApiController:apiGroupPermissionGet',
'verb' => RouteVerb::PUT,
Expand Down Expand Up @@ -299,7 +299,7 @@
],
],
],
'^.*/admin/account/permission.*$' => [
'^.*/admin/account/permission(\?.*$|$)' => [
[
'dest' => '\Modules\Admin\Controller\ApiController:apiAccountPermissionGet',
'verb' => RouteVerb::GET,
Expand Down Expand Up @@ -337,7 +337,7 @@
],
],
],
'^.*/admin/module/reinit.*$' => [
'^.*/admin/module/reinit(\?.*$|$)' => [
[
'dest' => '\Modules\Admin\Controller\ApiController:apiReInit',
'verb' => RouteVerb::GET,
Expand All @@ -349,7 +349,7 @@
],
],

'^.*/admin/update/url.*$' => [
'^.*/admin/update/url(\?.*$|$)' => [
[
'dest' => '\Modules\Admin\Controller\ApiController:apiUpdateFile',
'verb' => RouteVerb::GET,
Expand All @@ -360,7 +360,7 @@
],
],
],
'^.*/admin/update/check.*$' => [
'^.*/admin/update/check(\?.*$|$)' => [
[
'dest' => '\Modules\Admin\Controller\ApiController:apiCheckForUpdates',
'verb' => RouteVerb::PUT,
Expand All @@ -371,7 +371,7 @@
],
],
],
'^.*/admin/update/component.*$' => [
'^.*/admin/update/component(\?.*$|$)' => [
[
'dest' => '\Modules\Admin\Controller\ApiController:apiCheckForUpdates',
'verb' => RouteVerb::PUT,
Expand All @@ -382,4 +382,62 @@
],
],
],
'^.*/account/address$' => [
[
'dest' => '\Modules\Admin\Controller\ApiAttributeController:apiAddressCreate',
'verb' => RouteVerb::PUT,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::CREATE,
'state' => PermissionCategory::ADDRESS,
],
],
[
'dest' => '\Modules\Admin\Controller\ApiAttributeController:apiAddressUpdate',
'verb' => RouteVerb::SET,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::MODIFY,
'state' => PermissionCategory::ADDRESS,
],
],
[
'dest' => '\Modules\Admin\Controller\ApiAttributeController:apiAddressDelete',
'verb' => RouteVerb::DELETE,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::DELETE,
'state' => PermissionCategory::ADDRESS,
],
],
],
'^.*/account/contact$' => [
[
'dest' => '\Modules\Admin\Controller\ApiAttributeController:apiContactCreate',
'verb' => RouteVerb::PUT,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::CREATE,
'state' => PermissionCategory::ADDRESS,
],
],
[
'dest' => '\Modules\Admin\Controller\ApiAttributeController:apiContactUpdate',
'verb' => RouteVerb::SET,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::MODIFY,
'state' => PermissionCategory::ADDRESS,
],
],
[
'dest' => '\Modules\Admin\Controller\ApiAttributeController:apiContactDelete',
'verb' => RouteVerb::DELETE,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::DELETE,
'state' => PermissionCategory::ADDRESS,
],
],
],
];
Loading

0 comments on commit 35f5c85

Please sign in to comment.