mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-10 06:27:24 +01:00
Optimized Actions, Tests and renamed LIST to THREAD out of php incompatibility reasons
This commit is contained in:
parent
c2d0c5f60d
commit
81dd63c152
@ -11,13 +11,13 @@ use App\DBAL\Types\Meta\Right\CRUDType;
|
|||||||
*/
|
*/
|
||||||
final class ActionType extends CRUDType
|
final class ActionType extends CRUDType
|
||||||
{
|
{
|
||||||
const LIST = 'list';
|
const THREAD = 'thread';
|
||||||
|
|
||||||
protected static $choices = [
|
protected static $choices = [
|
||||||
parent::CREATE => 'create',
|
parent::CREATE => 'create',
|
||||||
parent::READ => 'read',
|
parent::READ => 'read',
|
||||||
parent::UPDATE => 'update',
|
parent::UPDATE => 'update',
|
||||||
parent::DELETE => 'delete',
|
parent::DELETE => 'delete',
|
||||||
self::LIST => 'list',
|
self::THREAD => 'thread',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,15 @@ use App\Domain\ActionManagement\AbstractAction;
|
|||||||
/**
|
/**
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
*/
|
*/
|
||||||
abstract class AbstractCreateAction extends AbstractAction
|
abstract class AbstractCreateAction extends AbstractAction implements CreateActionInterface
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @see \App\Domain\ActionManagement\AbstractAction::isSecure()
|
||||||
|
*/
|
||||||
|
protected function isSecure(): bool
|
||||||
|
{
|
||||||
|
return $this->actionService->isRequestedActionSecure();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domain\ActionManagement\Create;
|
||||||
|
|
||||||
|
use App\Domain\ActionManagement\ActionInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kevinfrantz
|
||||||
|
*/
|
||||||
|
interface CreateActionInterface extends ActionInterface
|
||||||
|
{
|
||||||
|
}
|
@ -7,10 +7,6 @@ namespace App\Domain\ActionManagement\Create;
|
|||||||
*/
|
*/
|
||||||
final class CreateSourceAction extends AbstractCreateAction
|
final class CreateSourceAction extends AbstractCreateAction
|
||||||
{
|
{
|
||||||
protected function isSecure(): bool
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function isValidByForm(): bool
|
protected function isValidByForm(): bool
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domain\ActionManagement\Thread;
|
||||||
|
|
||||||
|
use App\Domain\ActionManagement\AbstractAction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kevinfrantz
|
||||||
|
*/
|
||||||
|
abstract class AbstractThreadAction extends AbstractAction
|
||||||
|
{
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domain\ActionManagement\Thread;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kevinfrantz
|
||||||
|
*/
|
||||||
|
final class ThreadSourceAction extends AbstractThreadAction
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @see \App\Domain\ActionManagement\AbstractAction::isSecure()
|
||||||
|
*/
|
||||||
|
protected function isSecure(): bool
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function isValidByForm(): bool
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function proccess()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domain\ActionManagement\Update;
|
||||||
|
|
||||||
|
use App\Domain\ActionManagement\AbstractAction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kevinfrantz
|
||||||
|
*/
|
||||||
|
abstract class AbstractUpdateAction extends AbstractAction
|
||||||
|
{
|
||||||
|
}
|
@ -2,6 +2,20 @@
|
|||||||
|
|
||||||
namespace App\Domain\ActionManagement\Update;
|
namespace App\Domain\ActionManagement\Update;
|
||||||
|
|
||||||
class UpdateSourceAction
|
/**
|
||||||
|
* @author kevinfrantz
|
||||||
|
*/
|
||||||
|
final class UpdateSourceAction extends AbstractUpdateAction
|
||||||
|
{
|
||||||
|
protected function isSecure(): bool
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function isValidByForm(): bool
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function proccess()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -19,7 +19,7 @@ final class LayerActionMap implements LayerActionMapInterface
|
|||||||
ActionType::CREATE,
|
ActionType::CREATE,
|
||||||
ActionType::UPDATE,
|
ActionType::UPDATE,
|
||||||
ActionType::DELETE,
|
ActionType::DELETE,
|
||||||
ActionType::LIST,
|
ActionType::THREAD,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class RequestedAction extends RequestedUser implements RequestedActionInterface
|
|||||||
* @var array Containes the mapping of non standard actions to a crud
|
* @var array Containes the mapping of non standard actions to a crud
|
||||||
*/
|
*/
|
||||||
const ACTION_CRUD_MAP = [
|
const ACTION_CRUD_MAP = [
|
||||||
ActionType::LIST => CRUDType::READ,
|
ActionType::THREAD => CRUDType::READ,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,16 +2,15 @@
|
|||||||
|
|
||||||
namespace tests\Unit\Domain\SecureCRUDManagement\Factory;
|
namespace tests\Unit\Domain\SecureCRUDManagement\Factory;
|
||||||
|
|
||||||
use App\DBAL\Types\Meta\Right\LayerType;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use App\Domain\ActionManagement\ActionFactoryServiceInterface;
|
use App\Domain\ActionManagement\ActionFactoryServiceInterface;
|
||||||
use App\Domain\ActionManagement\ActionFactoryService;
|
use App\Domain\ActionManagement\ActionFactoryService;
|
||||||
use App\Domain\ActionManagement\ActionServiceInterface;
|
use App\Domain\ActionManagement\ActionServiceInterface;
|
||||||
use App\DBAL\Types\ActionType;
|
|
||||||
use App\Domain\ActionManagement\ActionInterface;
|
use App\Domain\ActionManagement\ActionInterface;
|
||||||
use App\Domain\RequestManagement\Action\RequestedActionInterface;
|
use App\Domain\RequestManagement\Action\RequestedActionInterface;
|
||||||
use App\Domain\RequestManagement\Action\RequestedAction;
|
use App\Domain\RequestManagement\Action\RequestedAction;
|
||||||
use App\Domain\RequestManagement\Right\RequestedRight;
|
use App\Domain\RequestManagement\Right\RequestedRight;
|
||||||
|
use App\Domain\LayerManagement\LayerActionMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
@ -44,8 +43,8 @@ class ActionFactoryServiceTest extends TestCase
|
|||||||
|
|
||||||
public function testCreate(): void
|
public function testCreate(): void
|
||||||
{
|
{
|
||||||
foreach (ActionType::getChoices() as $action) {
|
foreach (LayerActionMap::LAYER_ACTION_MAP as $layer => $actions) {
|
||||||
foreach (LayerType::getChoices() as $layer) {
|
foreach ($actions as $action) {
|
||||||
$this->requestedAction->setLayer($layer);
|
$this->requestedAction->setLayer($layer);
|
||||||
$this->requestedAction->setActionType($action);
|
$this->requestedAction->setActionType($action);
|
||||||
$result = $this->actionFactoryService->create();
|
$result = $this->actionFactoryService->create();
|
||||||
|
@ -41,7 +41,7 @@ class RequestedActionTest extends TestCase
|
|||||||
|
|
||||||
public function testList(): void
|
public function testList(): void
|
||||||
{
|
{
|
||||||
$list = ActionType::LIST;
|
$list = ActionType::THREAD;
|
||||||
$this->action->setActionType($list);
|
$this->action->setActionType($list);
|
||||||
$this->assertEquals($list, $this->action->getActionType());
|
$this->assertEquals($list, $this->action->getActionType());
|
||||||
$this->assertEquals(CRUDType::READ, $this->requestedRight->getCrud());
|
$this->assertEquals(CRUDType::READ, $this->requestedRight->getCrud());
|
||||||
|
Loading…
Reference in New Issue
Block a user