mirror of
https://github.com/Karaka-Management/oms-Auditor.git
synced 2026-02-01 06:48:41 +00:00
make id public, organigram impl. media password/encryption, settings bug fix, Money->FloatInt change, ...
This commit is contained in:
parent
d7e8894ba7
commit
92e280d8ff
41
Admin/Install/Workflow.install.json
Executable file
41
Admin/Install/Workflow.install.json
Executable file
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"triggers": [
|
||||
],
|
||||
"actions": {
|
||||
"1006200001": {
|
||||
"name": "Create blockchain",
|
||||
"description": {
|
||||
"en": "Create audit blockchain",
|
||||
"de": "Erstelle Audit Blockchain"
|
||||
},
|
||||
"function_type": "Cli",
|
||||
"function": "cliGenerateBlockchain",
|
||||
"module": "Auditor",
|
||||
"inputs": [
|
||||
],
|
||||
"outputs": [
|
||||
],
|
||||
"settings": {
|
||||
}
|
||||
}
|
||||
},
|
||||
"workflows": {
|
||||
"Blockchain audit": [
|
||||
{
|
||||
"id": "1005500005",
|
||||
"settings": {
|
||||
"interval": "* 2 * * *"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"id": "1006200001",
|
||||
"comment": "Create blockchain",
|
||||
"settings": {},
|
||||
"children": [
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
43
Admin/Install/Workflow.php
Executable file
43
Admin/Install/Workflow.php
Executable file
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Auditor\Admin\Install
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Auditor\Admin\Install;
|
||||
|
||||
use phpOMS\Application\ApplicationAbstract;
|
||||
|
||||
/**
|
||||
* Workflow class.
|
||||
*
|
||||
* @package Modules\Auditor\Admin\Install
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Workflow
|
||||
{
|
||||
/**
|
||||
* Install workflow providing
|
||||
*
|
||||
* @param ApplicationAbstract $app Application
|
||||
* @param string $path Module path
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function install(ApplicationAbstract $app, string $path) : void
|
||||
{
|
||||
\Modules\Workflow\Admin\Installer::installExternal($app, ['path' => __DIR__ . '/Workflow.install.json']);
|
||||
}
|
||||
}
|
||||
|
|
@ -15,7 +15,6 @@ declare(strict_types=1);
|
|||
namespace Modules\Auditor\Controller;
|
||||
|
||||
use Modules\Auditor\Models\AuditMapper;
|
||||
use Modules\Auditor\Models\NullAudit;
|
||||
use phpOMS\Contract\RenderableInterface;
|
||||
use phpOMS\DataStorage\Database\Query\OrderType;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
|
|
@ -61,15 +60,15 @@ final class CliController extends Controller
|
|||
->limit(1)
|
||||
->execute();
|
||||
|
||||
if ($first->getId() === 1) {
|
||||
if ($first->id === 1) {
|
||||
/** @var \Modules\Auditor\Models\Audit $first */
|
||||
$first = AuditMapper::get()
|
||||
->where('id', $first->getId() + 1)
|
||||
->where('id', $first->id + 1)
|
||||
->execute();
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
if (!($first instanceof NullAudit)) {
|
||||
if ($first->id > 0) {
|
||||
/** @var \Modules\Auditor\Models\Audit $last */
|
||||
$last = AuditMapper::get()
|
||||
->sort('id', OrderType::DESC)
|
||||
|
|
@ -78,13 +77,13 @@ final class CliController extends Controller
|
|||
|
||||
/** @var \Modules\Auditor\Models\Audit $previous */
|
||||
$previous = AuditMapper::get()
|
||||
->where('id', $first->getId() - 1)
|
||||
->where('id', $first->id - 1)
|
||||
->execute();
|
||||
|
||||
$current = $first;
|
||||
$endLastBatchId = $first->getId() - 1;
|
||||
$endLastBatchId = $first->id - 1;
|
||||
|
||||
while ($current->getId() !== 0 && $current->getId() <= $last->getId()) {
|
||||
while ($current->id !== 0 && $current->id <= $last->id) {
|
||||
/** @var \Modules\Auditor\Models\Audit[] $batch */
|
||||
$batch = AuditMapper::getAll()
|
||||
->where('id', $endLastBatchId, '>')
|
||||
|
|
@ -97,8 +96,8 @@ final class CliController extends Controller
|
|||
|
||||
$current->blockchain = \md5(
|
||||
$previous->blockchain
|
||||
. $current->getId()
|
||||
. $current->createdBy->getId()
|
||||
. $current->id
|
||||
. $current->createdBy->id
|
||||
. $current->createdAt->format('Y-m-d H:i:s')
|
||||
. $current->type
|
||||
. $current->trigger
|
||||
|
|
@ -115,7 +114,7 @@ final class CliController extends Controller
|
|||
$previous = $current;
|
||||
}
|
||||
|
||||
$endLastBatchId = $current->getId();
|
||||
$endLastBatchId = $current->id;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ use phpOMS\Account\Account;
|
|||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @todo: Add application id
|
||||
*/
|
||||
class Audit
|
||||
{
|
||||
|
|
@ -33,7 +35,7 @@ class Audit
|
|||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected int $id = 0;
|
||||
public int $id = 0;
|
||||
|
||||
/**
|
||||
* Audit type.
|
||||
|
|
|
|||
|
|
@ -66,9 +66,9 @@ echo $this->getData('nav')->render(); ?>
|
|||
<?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><?php if ($audit->old === null) : echo $this->getHtml('CREATE'); ?>
|
||||
<?php elseif ($audit->old !== null && $audit->new !== null) : echo $this->getHtml('UPDATE'); ?>
|
||||
|
|
@ -77,7 +77,7 @@ echo $this->getData('nav')->render(); ?>
|
|||
<?php endif; ?>
|
||||
<td><?= $this->printHtml((string) $audit->type); ?>
|
||||
<td><?= $this->printHtml($audit->trigger); ?>
|
||||
<td><a class="content" href="<?= UriFactory::build('{/base}/admin/account/settings?id=' . $audit->createdBy->getId()); ?>"><?= $this->printHtml(
|
||||
<td><a class="content" href="<?= UriFactory::build('{/base}/admin/account/settings?id=' . $audit->createdBy->id); ?>"><?= $this->printHtml(
|
||||
$this->renderUserName('%3$s %2$s %1$s', [$audit->createdBy->name1, $audit->createdBy->name2, $audit->createdBy->name3, $audit->createdBy->login])
|
||||
); ?></a>
|
||||
<td><?= $this->printHtml((string) $audit->ref); ?>
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ echo $this->getData('nav')->render();
|
|||
<td><?= $audit->type; ?>
|
||||
<tr>
|
||||
<th><?= $this->getHtml('By'); ?>
|
||||
<td><a href="<?= UriFactory::build('{/base}/admin/account/settings?{?}&id=' . $audit->createdBy->getId()); ?>"><?= $audit->createdBy->name1; ?> <?= $audit->createdBy->name2; ?></a>
|
||||
<td><a href="<?= UriFactory::build('{/base}/admin/account/settings?{?}&id=' . $audit->createdBy->id); ?>"><?= $audit->createdBy->name1; ?> <?= $audit->createdBy->name2; ?></a>
|
||||
<tr>
|
||||
<th><?= $this->getHtml('Ref'); ?>
|
||||
<td><?= $this->printHtml((string) $audit->ref); ?>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@
|
|||
"Admin": "1.0.0"
|
||||
},
|
||||
"providing": {
|
||||
"Navigation": "*"
|
||||
"Navigation": "*",
|
||||
"Workflow": "*"
|
||||
},
|
||||
"load": [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
|||
$logs = AuditMapper::getAll()->execute();
|
||||
|
||||
foreach($logs as $log) {
|
||||
if ($log->getId() > 0
|
||||
if ($log->id > 0
|
||||
&& $log->type === 1
|
||||
&& $log->trigger === 'test-trigger'
|
||||
&& $log->module === 'Auditor'
|
||||
|
|
@ -127,7 +127,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
|||
|
||||
$found = false;
|
||||
foreach($logs as $log) {
|
||||
if ($log->getId() > 0
|
||||
if ($log->id > 0
|
||||
&& $log->type === 1
|
||||
&& $log->trigger === 'test-trigger'
|
||||
&& $log->module === 'Auditor'
|
||||
|
|
@ -169,7 +169,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
|||
$logs = AuditMapper::getAll()->execute();
|
||||
|
||||
foreach($logs as $log) {
|
||||
if ($log->getId() > 0
|
||||
if ($log->id > 0
|
||||
&& $log->type === 1
|
||||
&& $log->trigger === 'test-trigger'
|
||||
&& $log->module === 'Auditor'
|
||||
|
|
|
|||
|
|
@ -42,11 +42,11 @@ final class AuditMapperTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
|
||||
$id = AuditMapper::create()->execute($audit);
|
||||
self::assertGreaterThan(0, $audit->getId());
|
||||
self::assertEquals($id, $audit->getId());
|
||||
self::assertGreaterThan(0, $audit->id);
|
||||
self::assertEquals($id, $audit->id);
|
||||
|
||||
$auditR = AuditMapper::get()
|
||||
->where('id', $audit->getId())
|
||||
->where('id', $audit->id)
|
||||
->execute();
|
||||
|
||||
self::assertEquals($audit->type, $auditR->type);
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ final class AuditTest extends \PHPUnit\Framework\TestCase
|
|||
public function testDefault() : void
|
||||
{
|
||||
$audit = new Audit();
|
||||
self::assertEquals(0, $audit->getId());
|
||||
self::assertEquals(0, $audit->id);
|
||||
self::assertEquals(0, $audit->type);
|
||||
self::assertEquals('', $audit->trigger);
|
||||
self::assertNull($audit->module);
|
||||
|
|
@ -41,7 +41,7 @@ final class AuditTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertNull($audit->old);
|
||||
self::assertNull($audit->new);
|
||||
self::assertEquals(0, $audit->ip);
|
||||
self::assertEquals(0, $audit->createdBy->getId());
|
||||
self::assertEquals(0, $audit->createdBy->id);
|
||||
self::assertInstanceOf('\DateTimeImmutable', $audit->createdAt);
|
||||
}
|
||||
|
||||
|
|
@ -70,6 +70,6 @@ final class AuditTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals('old', $audit->old);
|
||||
self::assertEquals('new', $audit->new);
|
||||
self::assertEquals(\ip2long('127.0.0.1'), $audit->ip);
|
||||
self::assertEquals(0, $audit->createdBy->getId());
|
||||
self::assertEquals(0, $audit->createdBy->id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,6 @@ final class NullAuditTest extends \PHPUnit\Framework\TestCase
|
|||
public function testId() : void
|
||||
{
|
||||
$null = new NullAudit(2);
|
||||
self::assertEquals(2, $null->getId());
|
||||
self::assertEquals(2, $null->id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user