mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-11-04 03:07:58 +00:00 
			
		
		
		
	Optimized SecureCRUDManagement Draft
This commit is contained in:
		@@ -2,7 +2,7 @@
 | 
			
		||||
 | 
			
		||||
namespace App\Domain\SecureCRUDManagement\CRUD\Create;
 | 
			
		||||
 | 
			
		||||
use App\Domain\SecureCRUDManagement\AbstractSecureCRUD;
 | 
			
		||||
use App\Domain\SecureCRUDManagement\CRUD\AbstractSecureCRUD;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author kevinfrantz
 | 
			
		||||
 
 | 
			
		||||
@@ -2,8 +2,8 @@
 | 
			
		||||
 | 
			
		||||
namespace App\Domain\SecureCRUDManagement\CRUD\Create;
 | 
			
		||||
 | 
			
		||||
use App\Domain\SecureCRUDManagement\SecureCRUDInterface;
 | 
			
		||||
use App\Entity\EntityInterface;
 | 
			
		||||
use App\Domain\SecureCRUDManagement\CRUD\SecureCRUDInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @todo Implement!
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,21 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace App\Domain\SecureCRUDManagement\CRUD\Create;
 | 
			
		||||
 | 
			
		||||
use App\Entity\EntityInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author kevinfrantz
 | 
			
		||||
 */
 | 
			
		||||
final class SecureHeredityCreator extends AbstractSecureCreator
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @todo Implement
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     *
 | 
			
		||||
     * @see \App\Domain\SecureCRUDManagement\CRUD\Create\SecureCreatorInterface::create()
 | 
			
		||||
     */
 | 
			
		||||
    public function create(): EntityInterface
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -2,7 +2,6 @@
 | 
			
		||||
 | 
			
		||||
namespace App\Domain\SecureCRUDManagement\CRUD\Create;
 | 
			
		||||
 | 
			
		||||
use App\Domain\SecureCRUDManagement\Create\AbstractSecureCreator;
 | 
			
		||||
use App\Entity\EntityInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -10,11 +9,6 @@ use App\Entity\EntityInterface;
 | 
			
		||||
 */
 | 
			
		||||
final class SecureMemberCreator extends AbstractSecureCreator
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     *
 | 
			
		||||
     * @see \App\Domain\SecureCRUDManagement\Create\SecureCreatorInterface::create()
 | 
			
		||||
     */
 | 
			
		||||
    public function create(): EntityInterface
 | 
			
		||||
    {
 | 
			
		||||
        //todo implement!
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,21 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace App\Domain\SecureCRUDManagement\CRUD\Create;
 | 
			
		||||
 | 
			
		||||
use App\Entity\EntityInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author kevinfrantz
 | 
			
		||||
 */
 | 
			
		||||
final class SecureRightCreator extends AbstractSecureCreator
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @todo Implement!
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     *
 | 
			
		||||
     * @see \App\Domain\SecureCRUDManagement\CRUD\Create\SecureCreatorInterface::create()
 | 
			
		||||
     */
 | 
			
		||||
    public function create(): EntityInterface
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -40,7 +40,7 @@ abstract class AbstractSecureCRUDFactoryService implements SecureCRUDFactoryServ
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    private function getClassName(string $layer, string $crud): string
 | 
			
		||||
    protected function getClassName(string $layer, string $crud): string
 | 
			
		||||
    {
 | 
			
		||||
        return 'Secure'.ucfirst(strtolower($layer)).$this->getCrud($crud);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -3,9 +3,8 @@
 | 
			
		||||
namespace App\Domain\SecureCRUDManagement\Factory;
 | 
			
		||||
 | 
			
		||||
use App\Entity\Meta\RightInterface;
 | 
			
		||||
use App\DBAL\Types\Meta\Right\LayerType;
 | 
			
		||||
use App\Domain\SecureCRUDManagement\CRUD\Create\SecureCreatorInterface;
 | 
			
		||||
use App\Domain\SecureCRUDManagement\CRUD\Create\SecureSourceCreator;
 | 
			
		||||
use App\DBAL\Types\Meta\Right\CRUDType;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author kevinfrantz
 | 
			
		||||
@@ -14,6 +13,19 @@ use App\Domain\SecureCRUDManagement\CRUD\Create\SecureSourceCreator;
 | 
			
		||||
 */
 | 
			
		||||
final class SecureCreatorFactoryService extends AbstractSecureCRUDFactoryService
 | 
			
		||||
{
 | 
			
		||||
    const CRUD_TYPE = CRUDType::CREATE;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param string $layer
 | 
			
		||||
     * @param string $crud
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    protected function getClassName(string $layer, string $crud): string
 | 
			
		||||
    {
 | 
			
		||||
        return 'Secure'.ucfirst(strtolower($layer)).'Creator';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     *
 | 
			
		||||
@@ -21,10 +33,8 @@ final class SecureCreatorFactoryService extends AbstractSecureCRUDFactoryService
 | 
			
		||||
     */
 | 
			
		||||
    public function create(RightInterface $requestedRight): SecureCreatorInterface
 | 
			
		||||
    {
 | 
			
		||||
        switch ($requestedRight->getLayer()) {
 | 
			
		||||
            case LayerType::SOURCE:
 | 
			
		||||
                return new SecureSourceCreator($this->request, $this->security);
 | 
			
		||||
            case LayerType::MEMBER:
 | 
			
		||||
        }
 | 
			
		||||
        $namespace = $this->getCRUDNamespace($requestedRight->getLayer(), self::CRUD_TYPE);
 | 
			
		||||
 | 
			
		||||
        return new $namespace($this->request, $this->security);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user