Dummy permission show account

This commit is contained in:
Dennis Eichhorn 2017-09-18 14:23:01 +02:00
parent 45cc7b5251
commit d39c2a3883
2 changed files with 64 additions and 0 deletions

View File

@ -19,6 +19,7 @@ use Modules\Admin\Models\Account;
use phpOMS\Account\AccountStatus;
use phpOMS\Account\AccountType;
use Modules\Admin\Models\AccountMapper;
use Modules\Admin\Models\AccountPermissionMapper;
use Modules\Admin\Models\Group;
use Modules\Admin\Models\GroupMapper;
use Modules\Admin\Models\GroupPermissionMapper;
@ -168,6 +169,16 @@ class Controller extends ModuleAbstract implements WebInterface
$view->addData('account', AccountMapper::get((int) $request->getData('id')));
$permissions = AccountPermissionMapper::getFor((int) $request->getData('id'), 'account');
if(!isset($permissions)) {
$permissions = [];
} elseif(!is_array($permissions)) {
$permissions = [$permissions];
}
$view->addData('permissions', $permissions);
return $view;
}

View File

@ -16,6 +16,8 @@
*/
$account = $this->getData('account');
$permissions = $this->getData('permissions');
echo $this->getData('nav')->render(); ?>
<div class="row">
@ -60,6 +62,23 @@ echo $this->getData('nav')->render(); ?>
</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>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('Groups'); ?></h1></header>
<div class="inner">
@ -76,6 +95,40 @@ echo $this->getData('nav')->render(); ?>
</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>Perm.
<tbody>
<?php $c = 0; foreach ($permissions as $key => $value) : $c++; $permission = $value->getPermission(); ?>
<tr>
<td><?= $value->getId(); ?>
<td><?= $value->getUnit(); ?>
<td><?= $value->getApp(); ?>
<td><?= $value->getModule(); ?>
<td><?= $value->getType(); ?>
<td><?= $value->getElement(); ?>
<td><?= $value->getComponent(); ?>
<td>
<?= \phpOMS\Account\PermissionType::CREATE | $permission === $permission ? 'C' : ''; ?>
<?= \phpOMS\Account\PermissionType::READ | $permission === $permission ? 'R' : ''; ?>
<?= \phpOMS\Account\PermissionType::MODIFY | $permission === $permission ? 'U' : ''; ?>
<?= \phpOMS\Account\PermissionType::DELETE | $permission === $permission ? 'D' : ''; ?>
<?= \phpOMS\Account\PermissionType::PERMISSION | $permission === $permission ? 'P' : ''; ?>
<?php endforeach; ?>
<?php if($c === 0) : ?>
<tr><td colspan="8" class="empty"><?= $this->getHtml('Empty', 0, 0); ?>
<?php endif; ?>
</table>
<section class="box wf-100">
<header><h1><?= $this->getHtml('Permissions'); ?></h1></header>
<div class="inner">