Test implementations

This commit is contained in:
Dennis Eichhorn 2018-09-19 17:41:04 +02:00
parent 85757d3e67
commit 11bfeabd85
14 changed files with 567 additions and 196 deletions

View File

@ -78,6 +78,17 @@ return [
],
],
],
'^.*/api/admin/find/group.*$' => [
[
'dest' => '\Modules\Admin\Controller:apiGroupFind',
'verb' => RouteVerb::GET,
'permission' => [
'module' => Controller::MODULE_NAME,
'type' => PermissionType::READ,
'state' => PermissionState::ACCOUNT,
],
],
],
'^.*/api/admin/account.*$' => [
[
@ -129,4 +140,50 @@ return [
],
],
],
'^.*/api/admin/group/account.*$' => [
[
'dest' => '\Modules\Admin\Controller:apiAddAccountToGroup',
'verb' => RouteVerb::PUT,
'permission' => [
'module' => Controller::MODULE_NAME,
'type' => PermissionType::MODIFY,
'state' => PermissionState::MODULE,
],
],
],
'^.*/api/admin/account/group.*$' => [
[
'dest' => '\Modules\Admin\Controller:apiAddGroupToAccount',
'verb' => RouteVerb::PUT,
'permission' => [
'module' => Controller::MODULE_NAME,
'type' => PermissionType::MODIFY,
'state' => PermissionState::MODULE,
],
],
],
'^.*/api/admin/group/permission.*$' => [
[
'dest' => '\Modules\Admin\Controller:apiAddGroupPermission',
'verb' => RouteVerb::PUT,
'permission' => [
'module' => Controller::MODULE_NAME,
'type' => PermissionType::PERMISSION,
'state' => PermissionState::MODULE,
],
],
],
'^.*/api/admin/account/permission.*$' => [
[
'dest' => '\Modules\Admin\Controller:apiAddAccountPermission',
'verb' => RouteVerb::PUT,
'permission' => [
'module' => Controller::MODULE_NAME,
'type' => PermissionType::PERMISSION,
'state' => PermissionState::MODULE,
],
],
],
];

View File

@ -18,10 +18,12 @@ use Model\Message\FormValidation;
use Modules\Admin\Models\Account;
use Modules\Admin\Models\AccountMapper;
use Modules\Admin\Models\AccountPermission;
use Modules\Admin\Models\AccountPermissionMapper;
use Modules\Admin\Models\NullAccountPermission;
use Modules\Admin\Models\Group;
use Modules\Admin\Models\GroupMapper;
use Modules\Admin\Models\GroupPermission;
use Modules\Admin\Models\GroupPermissionMapper;
use Modules\Admin\Models\NullGroupPermission;
use Modules\Admin\Models\PermissionState;
@ -42,6 +44,8 @@ use phpOMS\Utils\Parser\Markdown\Markdown;
use phpOMS\Views\View;
use phpOMS\DataStorage\Database\RelationType;
use phpOMS\Module\InfoManager;
use phpOMS\Account\PermissionAbstract;
use phpOMS\Account\PermissionOwner;
/**
* Admin controller class.
@ -218,6 +222,9 @@ final class Controller extends ModuleAbstract implements WebInterface
$view->addData('permissions', $permissions);
$accGrpSelector = new \Modules\Admin\Theme\Backend\Components\GroupTagSelector\GroupTagSelectorView($this->app, $request, $response);
$view->addData('grpSelector', $accGrpSelector);
return $view;
}
@ -296,6 +303,12 @@ final class Controller extends ModuleAbstract implements WebInterface
$view->addData('permissions', $permissions);
$accGrpSelector = new \Modules\Profile\Theme\Backend\Components\AccountGroupSelector\BaseView($this->app, $request, $response);
$view->addData('accGrpSelector', $accGrpSelector);
$editor = new \Modules\Editor\Theme\Backend\Components\Editor\BaseView($this->app, $request, $response);
$view->addData('editor', $editor);
return $view;
}
@ -318,6 +331,9 @@ final class Controller extends ModuleAbstract implements WebInterface
$view->setTemplate('/Modules/Admin/Theme/Backend/groups-create');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000103001, $request, $response));
$editor = new \Modules\Editor\Theme\Backend\Components\Editor\BaseView($this->app, $request, $response);
$view->addData('editor', $editor);
return $view;
}
@ -423,7 +439,9 @@ final class Controller extends ModuleAbstract implements WebInterface
$data = \json_decode((string) $request->getData('settings'), true);
}
$this->app->eventManager->trigger('PRE:Module:Admin-settings-set', '', $data);
$this->app->appSettings->set($data, true);
$this->app->eventManager->trigger('POST:Module:Admin-settings-set', '', $data);
$response->set($request->getUri()->__toString(), [
'status' => NotificationLevel::OK,
@ -474,7 +492,9 @@ final class Controller extends ModuleAbstract implements WebInterface
{
$group = $this->updateGroupFromRequest($request);
$this->app->eventManager->trigger('PRE:Module:Admin-group-update', '', $group);
GroupMapper::update($group);
$this->app->eventManager->trigger('POST:Module:Admin-group-update', '', $group);
$response->getHeader()->set('Content-Type', MimeType::M_JSON, true);
$response->set($request->getUri()->__toString(), [
@ -549,9 +569,9 @@ final class Controller extends ModuleAbstract implements WebInterface
$group = $this->createGroupFromRequest($request);
$this->app->eventManager->trigger('PRE:Module:Admin-groupcreate', '', $group);
$this->app->eventManager->trigger('PRE:Module:Admin-group-create', '', $group);
GroupMapper::create($group);
$this->app->eventManager->trigger('POST:Module:Admin-groupcreate', '', $group);
$this->app->eventManager->trigger('POST:Module:Admin-group-create', '', $group);
$response->getHeader()->set('Content-Type', MimeType::M_JSON, true);
$response->set($request->getUri()->__toString(), [
@ -600,9 +620,9 @@ final class Controller extends ModuleAbstract implements WebInterface
{
$group = GroupMapper::get((int) $request->getData('id'));
$this->app->eventManager->trigger('PRE:Module:Admin-groupdelete', '', $group);
$this->app->eventManager->trigger('PRE:Module:Admin-group-delete', '', $group);
$status = GroupMapper::delete($group);
$this->app->eventManager->trigger('POST:Module:Admin-groupdelete', '', $group);
$this->app->eventManager->trigger('POST:Module:Admin-group-delete', '', $group);
$response->getHeader()->set('Content-Type', MimeType::M_JSON, true);
$response->set($request->getUri()->__toString(), [
@ -613,6 +633,29 @@ final class Controller extends ModuleAbstract implements WebInterface
]);
}
/**
* Api method to find groups
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiGroupFind(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
{
$response->set(
$request->getUri()->__toString(),
\array_values(
GroupMapper::find((string) ($request->getData('search') ?? ''))
)
);
}
/**
* Api method to get an accoung
*
@ -709,11 +752,9 @@ final class Controller extends ModuleAbstract implements WebInterface
$account = $this->createAccountFromRequest($request);
$this->app->eventManager->trigger('PRE:Module:Admin-accountcreate', '', $account);
$this->app->eventManager->trigger('PRE:Module:Admin-account-create', '', $account);
AccountMapper::create($account);
$this->app->eventManager->trigger('POST:Module:Admin-accountcreate', '', $account);
$this->app->eventManager->trigger('POST:Module:Admin-account-create', '', $account);
$response->getHeader()->set('Content-Type', MimeType::M_JSON, true);
$response->set($request->getUri()->__toString(), [
@ -765,9 +806,9 @@ final class Controller extends ModuleAbstract implements WebInterface
{
$account = AccountMapper::get((int) ($request->getData('id')));
$this->app->eventManager->trigger('PRE:Module:Admin-accountdelete', '', $account);
$this->app->eventManager->trigger('PRE:Module:Admin-account-delete', '', $account);
$status = AccountMapper::delete($account);
$this->app->eventManager->trigger('POST:Module:Admin-accountdelete', '', $account);
$this->app->eventManager->trigger('POST:Module:Admin-account-delete', '', $account);
$response->getHeader()->set('Content-Type', MimeType::M_JSON, true);
$response->set($request->getUri()->__toString(), [
@ -794,7 +835,10 @@ final class Controller extends ModuleAbstract implements WebInterface
public function apiAccountUpdate(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
{
$account = $this->updateAccountFromRequest($request, true);
$status = AccountMapper::update($account);
$this->app->eventManager->trigger('PRE:Module:Admin-account-update', '', $account);
$status = AccountMapper::update($account);
$this->app->eventManager->trigger('POST:Module:Admin-account-update', '', $account);
$response->getHeader()->set('Content-Type', MimeType::M_JSON, true);
$response->set($request->getUri()->__toString(), [
@ -857,6 +901,7 @@ final class Controller extends ModuleAbstract implements WebInterface
return;
}
$this->app->eventManager->trigger('PRE:Module:Admin-module-status', '', ['status' => $status, 'module' => $module]);
switch ($status) {
case ModuleStatusUpdateType::ACTIVATE:
$done = $module === 'Admin' ? false : $this->app->moduleManager->activate($module);
@ -882,6 +927,7 @@ final class Controller extends ModuleAbstract implements WebInterface
$done = false;
$msg = 'Unknown module status change request.';
}
$this->app->eventManager->trigger('POST:Module:Admin-module-status', '', ['status' => $status, 'module' => $module]);
$response->getHeader()->set('Content-Type', MimeType::M_JSON, true);
$response->set($request->getUri()->__toString(), [
@ -891,4 +937,113 @@ final class Controller extends ModuleAbstract implements WebInterface
'response' => []
]);
}
public function apiAddGroupPermission(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
{
if (!empty($val = $this->validatePermissionCreate($request))) {
$response->set('permission_create', new FormValidation($val));
return;
}
$permission = $this->createPermissionFromRequest($request);
$this->app->eventManager->trigger('PRE:Module:Admin-group-permission-create', '', $permission);
GroupMapper::create($permission);
$this->app->eventManager->trigger('POST:Module:Admin-group-permission-create', '', $permission);
$response->getHeader()->set('Content-Type', MimeType::M_JSON, true);
$response->set($request->getUri()->__toString(), [
'status' => NotificationLevel::OK,
'title' => 'Group',
'message' => 'Group permission successfully created.',
'response' => $permission->jsonSerialize()
]);
}
/**
* Validate permission create request
*
* @param RequestAbstract $request Request
*
* @return array<string, bool>
*
* @since 1.0.0
*/
private function validatePermissionCreate(RequestAbstract $request) : array
{
$val = [];
if (($val['permissionowner'] = !PermissionOwner::isValidValue($request->getData('permissionowner')))
|| ($val['permissionref'] = !\is_numeric($request->getData('permissionref')))
) {
return $val;
}
return [];
}
/**
* Method to create a permission from request.
*
* @param RequestAbstract $request Request
*
* @return GroupPermission
*
* @since 1.0.0
*/
public function createPermissionFromRequest(RequestAbstract $request) : PermissionAbstract
{
$permission = $request->getData('permissionowner') === PermissionOwner::GROUP ? new GroupPermission((int) $request->getData('permissionref')) : new AccountPermission((int) $request->getData('permissionref'));
$permission->setUnit($request->getData('permissionunit') === null ? null : (int) $request->getData('permissionunit'));
$permission->setApp($request->getData('permissionapp') === null ? null : (string) $request->getData('permissionapp'));
$permission->setModule($request->getData('permissionmodule') === null ? null : (string) $request->getData('permissionmodule'));
$permission->setType($request->getData('permissiontype') === null ? null : (int) $request->getData('permissiontype'));
$permission->setElement($request->getData('permissionelement') === null ? null : (int) $request->getData('permissionelement'));
$permission->setComponent($request->getData('permissioncomponent') === null ? null : (int) $request->getData('permissioncomponent'));
$permission->setPermission(
(int) $request->getData('permissioncreate')
| (int) $request->getData('permissionread')
| (int) $request->getData('permissionupdate')
| (int) $request->getData('permissiondelete')
| (int) $request->getData('permissionpermission')
);
return $permission;
}
public function apiAddGroupToAccount(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
{
$account = (int) $request->getData('account');
$groups = \array_map('intval', $request->getDataList('igroup-idlist'));
$this->app->eventManager->trigger('PRE:Module:Admin-account-group-add', '', ['account' => $account, 'groups' => $groups]);
$success = AccountMapper::createRelation('groups', $account, $groups);
$this->app->eventManager->trigger('POST:Module:Admin-account-group-add', '', ['account' => $account, 'groups' => $groups]);
$response->getHeader()->set('Content-Type', MimeType::M_JSON, true);
$response->set($request->getUri()->__toString(), [
'status' => 'ok',
'title' => 'Account',
'message' => 'Group added to account',
'response' => []
]);
}
public function apiAddAccountToGroup(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
{
$group = (int) $request->getData('group');
$accounts = \array_map('intval', $request->getDataList('iaccount-idlist'));
$this->app->eventManager->trigger('PRE:Module:Admin-group-account-add', '', ['group' => $group, 'accounts' => $accounts]);
$success = GroupMapper::createRelation('accounts', $group, $accounts);
$this->app->eventManager->trigger('POST:Module:Admin-group-account-add', '', ['group' => $group, 'accounts' => $accounts]);
$response->getHeader()->set('Content-Type', MimeType::M_JSON, true);
$response->set($request->getUri()->__toString(), [
'status' => 'ok',
'title' => 'Group',
'message' => 'Account added to group',
'response' => []
]);
}
}

View File

@ -36,6 +36,18 @@ class AccountPermission extends PermissionAbstract
*/
private $account = 0;
/**
* Constructor.
*
* @param int $group Group id
*
* @since 1.0.0
*/
public function __construct(int $account = 0)
{
$this->account = $account;
}
/**
* Get account id
*

View File

@ -35,7 +35,7 @@ class GroupMapper extends DataMapperAbstract
*/
protected static $columns = [
'group_id' => ['name' => 'group_id', 'type' => 'int', 'internal' => 'id'],
'group_name' => ['name' => 'group_name', 'type' => 'string', 'internal' => 'name'],
'group_name' => ['name' => 'group_name', 'type' => 'string', 'internal' => 'name', 'autocomplete' => true],
'group_status' => ['name' => 'group_status', 'type' => 'int', 'internal' => 'status'],
'group_desc' => ['name' => 'group_desc', 'type' => 'string', 'internal' => 'description'],
'group_desc_raw' => ['name' => 'group_desc_raw', 'type' => 'string', 'internal' => 'descriptionRaw'],

View File

@ -36,6 +36,18 @@ class GroupPermission extends PermissionAbstract
*/
private $group = 0;
/**
* Constructor.
*
* @param int $group Group id
*
* @since 1.0.0
*/
public function __construct(int $group = 0)
{
$this->group = $group;
}
/**
* Get group id
*

View File

@ -0,0 +1,47 @@
<?php
/**
* Orange Management
*
* PHP Version 7.2
*
* @package TBD
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://website.orange-management.de
*/
declare(strict_types=1);
namespace Modules\Admin\Theme\Backend\Components\GroupTagSelector;
use phpOMS\Views\View;
use phpOMS\ApplicationAbstract;
use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract;
class GroupTagSelectorPopupView extends View
{
private $id = '';
public function __construct(ApplicationAbstract $app, RequestAbstract $request, ResponseAbstract $response)
{
parent::__construct($app, $request, $response);
$this->setTemplate('/Modules/Admin/Theme/Backend/Components/GroupTagSelector/group-selector-popup');
}
public function setId(string $id)
{
$this->id = $id;
}
public function getId() : string
{
return $this->id;
}
public function render(...$data) : string
{
$this->id = $data[0] ?? $this->id;
return parent::render();
}
}

View File

@ -0,0 +1,54 @@
<?php
/**
* Orange Management
*
* PHP Version 7.2
*
* @package TBD
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://website.orange-management.de
*/
declare(strict_types=1);
namespace Modules\Admin\Theme\Backend\Components\GroupTagSelector;
use phpOMS\Views\View;
use phpOMS\ApplicationAbstract;
use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract;
class GroupTagSelectorView extends View
{
private $id = '';
private $isRequired = false;
public function __construct(ApplicationAbstract $app, RequestAbstract $request, ResponseAbstract $response)
{
parent::__construct($app, $request, $response);
$this->setTemplate('/Modules/Admin/Theme/Backend/Components/GroupTagSelector/group-selector');
$view = new GroupTagSelectorPopupView($app, $request, $response);
$this->addData('group-selector-popup', $view);
}
public function getId() : string
{
return $this->id;
}
public function isRequired() : bool
{
return $this->isRequired;
}
public function render(...$data) : string
{
$this->id = $data[0];
$this->isRequired = $data[1] ?? false;
$this->getData('group-selector-popup')->setId($this->id);
return parent::render();
}
}

View File

@ -0,0 +1,48 @@
<template id="group-selector-tpl">
<section id="group-selector" class="box w-50" style="z-index: 9; position: absolute; margin: 0 auto; left: 50%; top: 50%; transform: translate(-50%, -50%);">
<header><h1><?= $this->getHtml('Group', 'Admin') ?></h1></header>
<div class="inner">
<label for="iSearchGroup">Search</label>
<input type="text" id="iSearchGroup" name="receiver-search" data-action='[
{
"key": 1, "listener": "keyup", "action": [
{"key": 1, "type": "utils.timer", "id": "iSearchGroup", "delay": 500, "resets": true},
{"key": 2, "type": "dom.table.clear", "id": "acc-table"},
{"key": 3, "type": "message.request", "uri": "{/base}/{/lang}/api/admin/find/group?search={#iSearchGroup}", "method": "GET", "request_type": "json"},
{"key": 4, "type": "dom.table.append", "id": "acc-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name/0"}, "position": -1}
]
}
]' autocomplete="off">
<table id="acc-table" class="table">
<thead>
<tr>
<th data-name="id">ID
<th data-name="name">Name
<th data-name="address">Address
<th data-name="city">City
<th data-name="zip">Zip
<th data-name="country">Country
<!-- todo: get data from tr in action and pass it to next actions, or make new request based on table cell? -->
<tbody data-action='[
{
"key": 1, "listener": "click", "selector": "#acc-table tbody tr", "action": [
{"key": 1, "type": "dom.getvalue", "base": "self", "selector": ""},
{"key": 2, "type": "dom.setvalue", "overwrite": false, "selector": "#{$id}-idlist", "value": "{0/id}", "data": ""},
{"key": 3, "type": "dom.setvalue", "overwrite": false, "selector": "#{$id}-taglist", "value": "<span id=\"{$id}-taglist-{0/id}\" class=\"tag red\" data-id=\"{0/id}\"><i class=\"fa fa-times\"></i> {0/name/0}, {0/name/1}<span>", "data": ""},
{"key": 4, "type": "dom.setvalue", "overwrite": true, "selector": "#{$id}", "value": "", "data": ""}
]
}
]'>
<tfoot>
</table>
<button type="button" id="iSearchGroup-close" data-action='[
{
"key": 1, "listener": "click", "action": [
{"key": 1, "type": "dom.remove", "selector": "#group-selector", "aniOut": "fadeOut"}
]
}
]'><?= $this->getHtml('Close', 'Admin') ?></button>
</div>
</section>
</template>

View File

@ -0,0 +1,49 @@
<div class="ipt-wrap">
<div class="ipt-first">
<span class="input">
<button type="button" id="<?= $this->printHtml($this->getId()); ?>-book-button" data-action='[
{
"key": 1, "listener": "click", "action": [
{"key": 1, "type": "dom.popup", "selector": "#group-selector-tpl", "aniIn": "fadeIn", "id": "<?= $this->printHtml($this->getId()); ?>"},
{"key": 2, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/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('/{/lang}/api/admin/group?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
{"key": 5, "type": "dom.table.append", "id": "grp-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name/0"}, "position": -1}
]
}
]'><i class="fa fa-book"></i></button>
<input type="text" list="<?= $this->printHtml($this->getId()); ?>-datalist" id="<?= $this->printHtml($this->getId()); ?>" 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->printHtml($this->getId()); ?>", "delay": 500, "resets": true},
{"key": 3, "type": "dom.datalist.clear", "id": "<?= $this->printHtml($this->getId()); ?>-datalist"},
{"key": 4, "type": "message.request", "uri": "{/base}/{/lang}/api/admin/find/group?search={#<?= $this->printHtml($this->getId()); ?>}", "method": "GET", "request_type": "json"},
{"key": 5, "type": "dom.datalist.append", "id": "<?= $this->printHtml($this->getId()); ?>-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->printHtml($this->getId()); ?>}", "method": "GET", "request_type": "json"},
{"key": 3, "type": "dom.setvalue", "overwrite": true, "selector": "#<?= $this->printHtml($this->getId()); ?>-idlist", "value": "{0/id}", "data": ""},
{"key": 4, "type": "dom.setvalue", "overwrite": true, "selector": "#<?= $this->printHtml($this->getId()); ?>-taglist", "value": "<span id=\"<?= $this->printHtml($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->printHtml($this->getId()); ?>", "value": "", "data": ""}
]
}
]'>
<datalist id="<?= $this->printHtml($this->getId()); ?>-datalist"></datalist>
<input type="hidden" id="<?= $this->printHtml($this->getId()); ?>-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->printHtml($this->getId()); ?>-taglist" data-action='[
{
"key": 1, "listener": "click", "selector": "#<?= $this->printHtml($this->getId()); ?>-taglist span fa", "action": [
{"key": 1, "type": "dom.getvalue", "base": "self"},
{"key": 2, "type": "dom.removevalue", "selector": "#<?= $this->printHtml($this->getId()); ?>-idlist", "data": ""},
{"key": 3, "type": "dom.remove", "base": "self"}
]
}
]'></div>

View File

@ -21,12 +21,16 @@ return [
'AuditLog' => 'Audit Log',
'Available' => 'Available',
'All' => 'All',
'App' => 'App',
'Area' => 'Area',
'Banned' => 'Banned',
'Cache' => 'Cache',
'Children' => 'Children',
'Close' => 'Close',
'Comp' => 'Comp.',
'Component' => 'Component',
'Country' => 'Country',
'Create' => 'Create',
'Created' => 'Created',
'CreatedBy' => 'Created By',
'Currency' => 'Currency',
@ -36,6 +40,8 @@ return [
'Description' => 'Description',
'Delete' => 'Delete',
'Deactivate' => 'Deactivate',
'Ele' => 'Ele.',
'Element' => 'Element',
'Email' => 'Email',
'EmailAdmin' => 'Email Admin',
'Fast' => 'Fast',
@ -88,11 +94,15 @@ return [
'PasswordChangeInterval' => 'Password Change Interval (days)',
'PasswordHistory' => 'Password History',
'PasswordRegex' => 'Password Regex',
'Perm' => 'Perm.',
'Permission' => 'Permission',
'Permissions' => 'Permissions',
'Person' => 'Person',
'Profile' => 'Profile',
'Read' => 'Read',
'RAddress' => 'Remote Address',
'ReCache' => 'Re-Cache',
'Release' => 'Release',
'Reset' => 'Reset',
'Running' => 'Running',
'Short' => 'Short',
@ -107,7 +117,7 @@ return [
'Specialchar' => 'Special character',
'Status' => 'Status',
'Total' => 'Total',
'Release' => 'Release',
'Type' => 'Type',
'Tablespoon' => 'Tablespoon',
'Teaspoon' => 'Teaspoon',
'Temperature' => 'Temperature',
@ -119,8 +129,9 @@ return [
'Timeformat' => 'Timeformat',
'Timeout' => 'Timeout',
'Timezone' => 'Timezone',
'Type' => 'Type',
'Unit' => 'Unit',
'Uninstall' => 'Uninstall',
'Update' => 'Update',
'Uppercase' => 'Uppercase',
'Username' => 'Username',
'Version' => 'Version',

View File

@ -54,62 +54,4 @@ echo $this->getData('nav')->render(); ?>
</div>
</section>
</div>
<div class="col-xs-12 col-md-4">
<table class="box table red">
<caption><?= $this->getHtml('Groups') ?></caption>
<thead>
<tr>
<td><?= $this->getHtml('ID', 0, 0); ?>
<td class="wf-100"><?= $this->getHtml('Name') ?>
<tbody>
<tr><td colspan="2" class="empty"><?= $this->getHtml('Empty', 0, 0); ?>
</table>
<section class="box wf-100">
<header><h1><?= $this->getHtml('Groups'); ?></h1></header>
<div class="inner">
<form action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/group'); ?>" method="post">
<table class="layout wf-100">
<tbody>
<tr><td><label for="iGroup"><?= $this->getHtml('Name'); ?></label>
<tr><td><input id="iGroup" name="group" type="text" placeholder="&#xf0c0; Guest">
<tr><td><input type="submit" value="<?= $this->getHtml('Add', 0, 0); ?>">
</table>
</form>
</div>
</section>
</div>
<div class="col-xs-12 col-md-4">
<table class="box table red">
<caption><?= $this->getHtml('Permissions') ?></caption>
<thead>
<tr>
<td><?= $this->getHtml('ID', 0, 0); ?>
<td>Unit
<td>App
<td>Module
<td>Type
<td>Ele.
<td>Comp.
<td class="wf-100">Perm.
<tbody>
<tr><td colspan="8" class="empty"><?= $this->getHtml('Empty', 0, 0); ?>
</table>
<section class="box wf-100">
<header><h1><?= $this->getHtml('Permissions'); ?></h1></header>
<div class="inner">
<form action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/group'); ?>" method="post">
<table class="layout wf-100">
<tbody>
<tr><td><label for="iPermission"><?= $this->getHtml('Name'); ?></label>
<tr><td><input id="iPermission" name="group" type="text" placeholder="&#xf084; news_create">
<tr><td><input type="submit" value="<?= $this->getHtml('Add', 0, 0); ?>">
</table>
</form>
</div>
</section>
</div>
</div>

View File

@ -113,16 +113,14 @@ echo $this->getData('nav')->render(); ?>
<section class="box wf-100">
<header><h1><?= $this->getHtml('Groups'); ?></h1></header>
<div class="inner">
<form action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/group'); ?>" method="post">
<form id="iAddGroupToAccount" action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/account/group'); ?>" method="put">
<table class="layout wf-100">
<tbody>
<tr><td><label for="iGroup"><?= $this->getHtml('Name'); ?></label>
<tr><td><?= $this->getData('grpSelector')->render('iGroup', true); ?>
<tr><td>
<span class="input">
<button type="button"><i class="fa fa-group"></i></button>
<input id="iGroup" name="group" type="text">
</span>
<tr><td><input type="submit" value="<?= $this->getHtml('Add', 0, 0); ?>">
<input name="account" type="hidden" value="<?= $this->printHtml($account->getId()); ?>">
<input type="submit" value="<?= $this->getHtml('Add', 0, 0); ?>">
</table>
</form>
</div>
@ -137,13 +135,13 @@ echo $this->getData('nav')->render(); ?>
<td>
<td>
<td><?= $this->getHtml('ID', 0, 0); ?>
<td>Unit
<td class="wf-100">App
<td>Module
<td>Type
<td>Ele.
<td>Comp.
<td class="wf-100">Perm.
<td><?= $this->getHtml('Unit'); ?>
<td><?= $this->getHtml('App'); ?>
<td><?= $this->getHtml('Module'); ?>
<td><?= $this->getHtml('Type'); ?>
<td><?= $this->getHtml('Ele'); ?>
<td><?= $this->getHtml('Comp'); ?>
<td class="wf-100"><?= $this->getHtml('Perm'); ?>
<tbody>
<?php $c = 0; foreach ($permissions as $key => $value) : $c++; $permission = $value->getPermission(); ?>
<tr>
@ -171,16 +169,47 @@ echo $this->getData('nav')->render(); ?>
<section class="box wf-100">
<header><h1><?= $this->getHtml('Permissions'); ?></h1></header>
<div class="inner">
<form action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/group'); ?>" method="post">
<form id="fAccountAddPermission" action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/group'); ?>" method="post">
<table class="layout wf-100">
<tbody>
<tr><td><label for="iPermiision"><?= $this->getHtml('Name'); ?></label>
<tbody>
<tr><td><label for="iPermissionUnit"><?= $this->getHtml('Unit'); ?></label>
<tr><td><input id="iPermissionUnit" name="permissionunit" type="text">
<tr><td><label for="iPermissionApp"><?= $this->getHtml('App'); ?></label>
<tr><td><input id="iPermissionApp" name="permissionapp" type="text">
<tr><td><label for="iPermissionModule"><?= $this->getHtml('Module'); ?></label>
<tr><td><input id="iPermissionModule" name="permissionmodule" type="text">
<tr><td><label for="iPermissionType"><?= $this->getHtml('Type'); ?></label>
<tr><td><input id="iPermissionType" name="permissiontype" type="text">
<tr><td><label for="iPermissionElement"><?= $this->getHtml('Element'); ?></label>
<tr><td><input id="iPermissionElement" name="permissionelement" type="text">
<tr><td><label for="iPermissionComponent"><?= $this->getHtml('Component'); ?></label>
<tr><td><input id="iPermissionComponent" name="permissioncomponent" type="text">
<tr><td><label><?= $this->getHtml('Permission'); ?></label>
<tr><td>
<span class="input">
<button type="button"><i class="fa fa-key"></i></button>
<input id="iPermiision" name="permission" type="text">
</span>
<tr><td><input type="submit" value="<?= $this->getHtml('Add', 0, 0); ?>">
<span class="checkbox">
<input id="iPermissionCreate" name="permissioncreate" type="checkbox" value="<?= \phpOMS\Account\PermissionType::CREATE ?>">
<label for="iPermissionCreate"><?= $this->getHtml('Create') ?></label>
</span>
<span class="checkbox">
<input id="iPermissionRead" name="permissionread" type="checkbox" value="<?= \phpOMS\Account\PermissionType::READ ?>">
<label for="iPermissionRead"><?= $this->getHtml('Read') ?></label>
</span>
<span class="checkbox">
<input id="iPermissionUpdate" name="permissionupdate" type="checkbox" value="<?= \phpOMS\Account\PermissionType::MODIFY ?>">
<label for="iPermissionUpdate"><?= $this->getHtml('Update') ?></label>
</span>
<span class="checkbox">
<input id="iPermissionDelete" name="permissiondelete" type="checkbox" value="<?= \phpOMS\Account\PermissionType::DELETE ?>">
<label for="iPermissionDelete"><?= $this->getHtml('Delete') ?></label>
</span>
<span class="checkbox">
<input id="iPermissionPermission" name="permissionpermission" type="checkbox" value="<?= \phpOMS\Account\PermissionType::PERMISSION ?>">
<label for="iPermissionPermission"><?= $this->getHtml('Permission') ?></label>
</span>
<tr><td>
<input type="hidden" name="permissionref" value="<?= $this->printHtml($group->getId()); ?>">
<input type="hidden" name="permissionowner" value="<?= \phpOMS\Account\PermissionOwner::GROUP ?>">
<input type="submit" value="<?= $this->getHtml('Add', 0, 0); ?>">
</table>
</form>
</div>

View File

@ -21,8 +21,8 @@ echo $this->getData('nav')->render(); ?>
<section class="box wf-100">
<header><h1><?= $this->getHtml('Group'); ?></h1></header>
<div class="inner">
<form id="group-create" action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/group'); ?>" method="put">
<table class="layout wf-100">
<form id="fGroupCreate" action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/group'); ?>" method="put">
<table class="layout wf-100" style="table-layout: fixed">
<tbody>
<tr><td><label for="iStatus"><?= $this->getHtml('Status'); ?></label>
<tr><td>
@ -32,93 +32,12 @@ echo $this->getData('nav')->render(); ?>
</select>
<tr><td><label for="iGname"><?= $this->getHtml('Name'); ?></label>
<tr><td><input id="iGname" name="name" type="text" placeholder="&#xf0c0; Guest" required>
<tr><td><label for="iGroupDescription"><?= $this->getHtml('Description'); ?></label>
<tr><td><textarea id="iGroupDescription" name="description" placeholder="&#xf040;"></textarea>
<tr><td><?= $this->getData('editor')->render('group-editor'); ?>
<tr><td><?= $this->getData('editor')->getData('text')->render('group-editor', 'description', 'fGroupCreate'); ?>
<tr><td><input type="submit" id="iCreate" name="create" value="<?= $this->getHtml('Create', 0, 0); ?>">
</table>
</form>
</div>
</section>
</div>
<div class="col-xs-12 col-md-4">
<table class="box table red wf-100">
<caption><?= $this->getHtml('Parents') ?></caption>
<thead>
<tr>
<td><?= $this->getHtml('ID', 0, 0); ?>
<td class="wf-100">Name
<tbody>
<?php $c = 0; foreach ([] as $key => $value) : $c++; ?>
<tr>
<td>
<td>
<?php endforeach; ?>
<?php if ($c === 0) : ?>
<tr><td colspan="2" class="empty"><?= $this->getHtml('Empty', 0, 0); ?>
<?php endif; ?>
</table>
<section class="box wf-100">
<header><h1><?= $this->getHtml('Parent'); ?></h1></header>
<div class="inner">
<form action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/group'); ?>" method="post">
<table class="layout wf-100">
<tbody>
<tr><td><label for="iGParentName"><?= $this->getHtml('Name'); ?></label>
<tr><td><input id="iGParentName" name="parentname" type="text" placeholder="&#xf0c0; Guest">
<tr><td><input type="submit" value="<?= $this->getHtml('Add', 0, 0); ?>">
</table>
</form>
</div>
</section>
</div>
<div class="col-xs-12 col-md-4">
<table class="box table red wf-100">
<caption><?= $this->getHtml('Permissions') ?></caption>
<thead>
<tr>
<td><?= $this->getHtml('ID', 0, 0); ?>
<td>Unit
<td>App
<td>Module
<td>Type
<td>Ele.
<td>Comp.
<td class="wf-100">Perm.
<tbody>
<tr><td colspan="8" class="empty"><?= $this->getHtml('Empty', 0, 0); ?>
</table>
<section class="box wf-100">
<header><h1><?= $this->getHtml('Permissions'); ?></h1></header>
<div class="inner">
<form action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/group'); ?>" method="post">
<table class="layout wf-100">
<tbody>
<tr><td><label for="iPermissionName"><?= $this->getHtml('Name'); ?></label>
<tr><td><input id="iPermissionName" name="permissionname" type="text" placeholder="&#xf084; Admin">
<tr><td><input type="submit" value="<?= $this->getHtml('Add', 0, 0); ?>">
</table>
</form>
</div>
</section>
</div>
<div class="col-xs-12 col-md-4">
<section class="box wf-100">
<header><h1><?= $this->getHtml('Accounts'); ?></h1></header>
<div class="inner">
<form action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/group'); ?>" method="post">
<table class="layout wf-100">
<tbody>
<tr><td><label for="iGParentName"><?= $this->getHtml('Name'); ?></label>
<tr><td><input id="iGParentName" name="parentname" type="text" placeholder="&#xf234; Donald Duck">
<tr><td><input type="submit" value="<?= $this->getHtml('Add', 0, 0); ?>">
</table>
</form>
</div>
</section>
</div>
</div>

View File

@ -36,7 +36,7 @@ echo $this->getData('nav')->render(); ?>
<header><h1><?= $this->getHtml('Group'); ?></h1></header>
<div class="inner">
<form id="fGroupEdit" action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/group'); ?>" method="post">
<table class="layout wf-100">
<table class="layout wf-100" style="table-layout: fixed">
<tbody>
<tr><td><label for="iGid"><?= $this->getHtml('ID', 0, 0); ?></label>
<tr><td><input id="iGid" name="id" type="text" value="<?= $this->printHtml($group->getId()); ?>" disabled>
@ -48,9 +48,8 @@ echo $this->getData('nav')->render(); ?>
<option value="<?= $stat; ?>"<?= $stat === $group->getStatus() ? ' selected' : ''; ?>><?= $this->getHtml('GroupStatus' . $stat); ?>
<?php endforeach; ?>
</select>
<tr><td><label for="iGroupDescription"><?= $this->getHtml('Description'); ?></label>
<tr><td>
<textarea id="iGroupDescription" name="description" placeholder="&#xf040;"><?= $this->printHtml($group->getDescription()); ?></textarea>
<tr><td><?= $this->getData('editor')->render('group-editor'); ?>
<tr><td><?= $this->getData('editor')->getData('text')->render('group-editor', 'description', 'fGroupEdit'); ?>
<tr><td><input id="groupSubmit" name="groupsubmit" type="submit" value="<?= $this->getHtml('Save', 0, 0); ?>">
</table>
</form>
@ -79,12 +78,14 @@ echo $this->getData('nav')->render(); ?>
<section class="box wf-100">
<header><h1><?= $this->getHtml('Accounts'); ?></h1></header>
<div class="inner">
<form action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/group'); ?>" method="post">
<form id="iAddAccountToGroup" action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/group/account'); ?>" method="put">
<table class="layout wf-100">
<tbody>
<tr><td><label for="iGParentName"><?= $this->getHtml('Name'); ?></label>
<tr><td><input id="iGParentName" name="parentname" type="text" placeholder="&#xf234; Donald Duck">
<tr><td><input type="submit" value="<?= $this->getHtml('Add', 0, 0); ?>">
<tr><td><?= $this->getData('accGrpSelector')->render('iAccount', true); ?>
<tr><td>
<input name="group" type="hidden" value="<?= $this->printHtml($group->getId()); ?>">
<input type="submit" value="<?= $this->getHtml('Add', 0, 0); ?>">
</table>
</form>
</div>
@ -99,13 +100,13 @@ echo $this->getData('nav')->render(); ?>
<td>
<td>
<td><?= $this->getHtml('ID', 0, 0); ?>
<td>Unit
<td class="wf-100">App
<td>Module
<td>Type
<td>Ele.
<td>Comp.
<td class="wf-100">Perm.
<td><?= $this->getHtml('Unit'); ?>
<td><?= $this->getHtml('App'); ?>
<td><?= $this->getHtml('Module'); ?>
<td><?= $this->getHtml('Type'); ?>
<td><?= $this->getHtml('Ele'); ?>
<td><?= $this->getHtml('Comp'); ?>
<td class="wf-100"><?= $this->getHtml('Perm'); ?>
<tbody>
<?php $c = 0; foreach ($permissions as $key => $value) : $c++; $permission = $value->getPermission(); ?>
<tr>
@ -133,12 +134,47 @@ echo $this->getData('nav')->render(); ?>
<section class="box wf-100">
<header><h1><?= $this->getHtml('Permissions'); ?></h1></header>
<div class="inner">
<form action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/group'); ?>" method="post">
<form id="fGroupAddPermission" action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/group'); ?>" method="post">
<table class="layout wf-100">
<tbody>
<tr><td><label for="iPermissionName"><?= $this->getHtml('Name'); ?></label>
<tr><td><input id="iPermissionName" name="permissionname" type="text" placeholder="&#xf084; Admin">
<tr><td><input type="submit" value="<?= $this->getHtml('Add', 0, 0); ?>">
<tr><td><label for="iPermissionUnit"><?= $this->getHtml('Unit'); ?></label>
<tr><td><input id="iPermissionUnit" name="permissionunit" type="text">
<tr><td><label for="iPermissionApp"><?= $this->getHtml('App'); ?></label>
<tr><td><input id="iPermissionApp" name="permissionapp" type="text">
<tr><td><label for="iPermissionModule"><?= $this->getHtml('Module'); ?></label>
<tr><td><input id="iPermissionModule" name="permissionmodule" type="text">
<tr><td><label for="iPermissionType"><?= $this->getHtml('Type'); ?></label>
<tr><td><input id="iPermissionType" name="permissiontype" type="text">
<tr><td><label for="iPermissionElement"><?= $this->getHtml('Element'); ?></label>
<tr><td><input id="iPermissionElement" name="permissionelement" type="text">
<tr><td><label for="iPermissionComponent"><?= $this->getHtml('Component'); ?></label>
<tr><td><input id="iPermissionComponent" name="permissioncomponent" type="text">
<tr><td><label><?= $this->getHtml('Permission'); ?></label>
<tr><td>
<span class="checkbox">
<input id="iPermissionCreate" name="permissioncreate" type="checkbox" value="<?= \phpOMS\Account\PermissionType::CREATE ?>">
<label for="iPermissionCreate"><?= $this->getHtml('Create') ?></label>
</span>
<span class="checkbox">
<input id="iPermissionRead" name="permissionread" type="checkbox" value="<?= \phpOMS\Account\PermissionType::READ ?>">
<label for="iPermissionRead"><?= $this->getHtml('Read') ?></label>
</span>
<span class="checkbox">
<input id="iPermissionUpdate" name="permissionupdate" type="checkbox" value="<?= \phpOMS\Account\PermissionType::MODIFY ?>">
<label for="iPermissionUpdate"><?= $this->getHtml('Update') ?></label>
</span>
<span class="checkbox">
<input id="iPermissionDelete" name="permissiondelete" type="checkbox" value="<?= \phpOMS\Account\PermissionType::DELETE ?>">
<label for="iPermissionDelete"><?= $this->getHtml('Delete') ?></label>
</span>
<span class="checkbox">
<input id="iPermissionPermission" name="permissionpermission" type="checkbox" value="<?= \phpOMS\Account\PermissionType::PERMISSION ?>">
<label for="iPermissionPermission"><?= $this->getHtml('Permission') ?></label>
</span>
<tr><td>
<input type="hidden" name="permissionref" value="<?= $this->printHtml($group->getId()); ?>">
<input type="hidden" name="permissionowner" value="<?= \phpOMS\Account\PermissionOwner::GROUP ?>">
<input type="submit" value="<?= $this->getHtml('Add', 0, 0); ?>">
</table>
</form>
</div>