mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 13:57:10 +02:00
Optimized documentation and class naming
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain;
|
||||
|
||||
/**
|
||||
* @deprecated Doesn't make sense!
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
abstract class AbstractDomainService
|
||||
{
|
||||
}
|
@@ -9,7 +9,7 @@ use App\Domain\PathManagement\NamespacePathMap;
|
||||
use App\Domain\PathManagement\NamespacePathMapInterface;
|
||||
|
||||
/**
|
||||
* Offers informations, which the system needs to handle Entities.
|
||||
* Offers some meta information about an entity.
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
|
@@ -17,7 +17,7 @@ use App\Domain\SourceManagement\SourceMemberInformation;
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
final class LawPermissionCheckerService implements LawPermissionCheckerServiceInterface
|
||||
final class LawPermissionChecker implements LawPermissionCheckerInterface
|
||||
{
|
||||
/**
|
||||
* @var LawInterface
|
||||
@@ -153,7 +153,7 @@ final class LawPermissionCheckerService implements LawPermissionCheckerServiceIn
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \App\Domain\LawManagement\LawPermissionCheckerServiceInterface::hasPermission()
|
||||
* @see \App\Domain\LawManagement\LawPermissionCheckerInterface::hasPermission()
|
||||
*/
|
||||
public function hasPermission(RightInterface $clientRight): bool
|
||||
{
|
@@ -5,11 +5,11 @@ namespace App\Domain\LawManagement;
|
||||
use App\Entity\Meta\RightInterface;
|
||||
|
||||
/**
|
||||
* Allows to check if a source has rights on a source.
|
||||
* Allows to check if a right has permission by a law.
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface LawPermissionCheckerServiceInterface
|
||||
interface LawPermissionCheckerInterface
|
||||
{
|
||||
/**
|
||||
* Checks if the client has the right for executing.
|
@@ -4,6 +4,13 @@ namespace App\Domain\MemberManagement;
|
||||
|
||||
use App\Entity\Meta\Relation\Member\MemberRelationInterface;
|
||||
|
||||
/**
|
||||
* Allows to add and remove members and memberships from member relations.
|
||||
*
|
||||
* @see MemberRelationInterface
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
final class MemberManager implements MemberManagerInterface
|
||||
{
|
||||
/**
|
||||
|
@@ -3,7 +3,7 @@
|
||||
namespace App\Domain\PathManagement;
|
||||
|
||||
/**
|
||||
* Be carefull with the case sensivity.
|
||||
* @todo Be carefull with the case sensivity. Solve this!
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
|
@@ -0,0 +1,69 @@
|
||||
# Domain
|
||||
This folder contains the [domain logic](https://en.wikipedia.org/wiki/Business_logic) of the application.
|
||||
|
||||
## Conventions
|
||||
### Services
|
||||
Classes which are optimized to be injected as a service MUST end on the suffix ** *Service.php**.
|
||||
## Folders
|
||||
A folder MUST end on the suffix ** *Management ** to show that it has the purpose to manage something.
|
||||
|
||||
# Domain Overview
|
||||
|
||||
## Entity Management
|
||||
### Entity Meta Information ###
|
||||
Offers some meta information about an entity
|
||||
|
||||
## Form Management
|
||||
- FormMetaInformation
|
||||
|
||||
## Law Management
|
||||
### LawPermissionChecker ###
|
||||
Allows to check if a right has permission by a law.
|
||||
|
||||
## Member Management
|
||||
### Member Manager ###
|
||||
Allows to add and remove members and memberships from member relations.
|
||||
|
||||
## Path Management
|
||||
|
||||
### Namespace Path Map ###
|
||||
Maps a path to a namespace.
|
||||
|
||||
## Request Management
|
||||
|
||||
Offers classes to manage requests for rights, users and sources.
|
||||
|
||||
### Logic
|
||||
- Requested Right
|
||||
- Requested Source
|
||||
- Requested User
|
||||
|
||||
### Services
|
||||
- Requested Right Service
|
||||
- Requested Source Service
|
||||
- Requested User Service
|
||||
|
||||
## Right Management
|
||||
### Right Checker ###
|
||||
Checks if the crud, layer and source combination is granted by a right.
|
||||
### Right Layer Combination Service ###
|
||||
Allows to get the possible cruds for a layer, or the possible layers for a crud.
|
||||
## Source Management
|
||||
### Source Member Information ###
|
||||
Offers to get all source members over all dimensions.
|
||||
### Source Member Manager
|
||||
Offers to add and remove source members and memberships.
|
||||
### Source Membership Information
|
||||
Offers to get all memberships of a source.
|
||||
### Source Right Manager
|
||||
Allows to add and remove rights of a source.
|
||||
### Tree Source Information
|
||||
Allows to get branches and leaves of a tree.
|
||||
## Template Management
|
||||
### Template Path Management
|
||||
Manages all informations which are needed to process templates.
|
||||
## User Management
|
||||
### User Source Director
|
||||
Offers based on an user variable a user with a source.
|
||||
### User Source Director Service
|
||||
Offers the _user source director_ to be used as a service, based on the _entity manager_ and _security_.
|
||||
|
@@ -5,6 +5,8 @@ namespace App\Domain\RightManagement;
|
||||
use App\Entity\Source\SourceInterface;
|
||||
|
||||
/**
|
||||
* Checks if the crud, layer and source combination is granted by a right.
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface RightCheckerInterface
|
||||
|
@@ -6,6 +6,8 @@ use App\DBAL\Types\Meta\Right\LayerType;
|
||||
use App\DBAL\Types\Meta\Right\CRUDType;
|
||||
|
||||
/**
|
||||
* Allows to get the possible cruds for a layer, or the possible layers for a crud.
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface RightLayerCombinationServiceInterface
|
||||
|
@@ -4,7 +4,7 @@ namespace App\Domain\SecureManagement;
|
||||
|
||||
use App\Entity\Meta\RightInterface;
|
||||
use App\Entity\Source\SourceInterface;
|
||||
use App\Domain\LawManagement\LawPermissionCheckerService;
|
||||
use App\Domain\LawManagement\LawPermissionChecker;
|
||||
use App\Exception\SourceAccessDenied;
|
||||
|
||||
/**
|
||||
@@ -94,7 +94,7 @@ final class SecureSourceChecker implements SecureSourceCheckerInterface
|
||||
*/
|
||||
public function hasPermission(RightInterface $requestedRight): bool
|
||||
{
|
||||
$law = new LawPermissionCheckerService($this->source->getLaw());
|
||||
$law = new LawPermissionChecker($this->source->getLaw());
|
||||
|
||||
return $law->hasPermission($requestedRight) && $this->itterateOverSourceAttributs($requestedRight);
|
||||
}
|
||||
|
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\SourceManagement;
|
||||
|
||||
use App\Domain\AbstractDomainService;
|
||||
|
||||
abstract class AbstractSourceService extends AbstractDomainService
|
||||
{
|
||||
}
|
@@ -5,6 +5,11 @@ namespace App\Domain\SourceManagement;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use App\Entity\Source\SourceInterface;
|
||||
|
||||
/**
|
||||
* Offers to get all source members over all dimensions.
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface SourceMemberInformationInterface
|
||||
{
|
||||
/**
|
||||
|
@@ -6,6 +6,9 @@ use App\Entity\Source\SourceInterface;
|
||||
use App\Domain\MemberManagement\MemberManagerInterface;
|
||||
use App\Domain\MemberManagement\MemberManager;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
final class SourceMemberManager implements SourceMemberManagerInterface
|
||||
{
|
||||
/**
|
||||
@@ -18,27 +21,50 @@ final class SourceMemberManager implements SourceMemberManagerInterface
|
||||
*/
|
||||
private $memberManager;
|
||||
|
||||
/**
|
||||
* @param SourceInterface $source
|
||||
*/
|
||||
public function __construct(SourceInterface $source)
|
||||
{
|
||||
$this->source = $source;
|
||||
$this->memberManager = new MemberManager($this->source->getMemberRelation());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \App\Domain\SourceManagement\SourceMemberManagerInterface::addMember()
|
||||
*/
|
||||
public function addMember(SourceInterface $member): void
|
||||
{
|
||||
$this->memberManager->addMember($member->getMemberRelation());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \App\Domain\SourceManagement\SourceMemberManagerInterface::removeMember()
|
||||
*/
|
||||
public function removeMember(SourceInterface $member): void
|
||||
{
|
||||
$this->memberManager->removeMember($member->getMemberRelation());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \App\Domain\SourceManagement\SourceMemberManagerInterface::addMembership()
|
||||
*/
|
||||
public function addMembership(SourceInterface $membership): void
|
||||
{
|
||||
$this->memberManager->addMembership($membership->getMemberRelation());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \App\Domain\SourceManagement\SourceMemberManagerInterface::removeMembership()
|
||||
*/
|
||||
public function removeMembership(SourceInterface $membership): void
|
||||
{
|
||||
$this->memberManager->removeMembership($membership->getMemberRelation());
|
||||
|
@@ -4,6 +4,11 @@ namespace App\Domain\SourceManagement;
|
||||
|
||||
use App\Entity\Source\SourceInterface;
|
||||
|
||||
/**
|
||||
* Offers to add and remove source members and memberships.
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface SourceMemberManagerInterface
|
||||
{
|
||||
/**
|
||||
|
@@ -7,6 +7,9 @@ use App\Entity\Source\SourceInterface;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use App\Entity\Meta\Relation\Member\MemberRelationInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
final class SourceMembershipInformation implements SourceMembershipInformationInterface
|
||||
{
|
||||
/**
|
||||
@@ -19,6 +22,9 @@ final class SourceMembershipInformation implements SourceMembershipInformationIn
|
||||
*/
|
||||
private $memberships;
|
||||
|
||||
/**
|
||||
* @param SourceInterface $source
|
||||
*/
|
||||
public function __construct(SourceInterface $source)
|
||||
{
|
||||
$this->source = $source;
|
||||
|
@@ -5,6 +5,11 @@ namespace App\Domain\SourceManagement;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use App\Entity\Source\SourceInterface;
|
||||
|
||||
/**
|
||||
* Offers to get all memberships of a source.
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface SourceMembershipInformationInterface
|
||||
{
|
||||
/**
|
||||
|
@@ -7,6 +7,11 @@ use App\Exception\AllreadySetException;
|
||||
use App\Exception\AllreadyDefinedException;
|
||||
use App\Exception\NotSetException;
|
||||
|
||||
/**
|
||||
* Allows to add and remove rights of a source.
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface SourceRightManagerInterface
|
||||
{
|
||||
/**
|
||||
|
@@ -15,7 +15,7 @@ use App\Entity\Source\SourceInterface;
|
||||
*
|
||||
* @todo Maybe lazy loading would be helpfull for performance
|
||||
*/
|
||||
final class TreeSourceService extends AbstractSourceService implements TreeSourceServiceInterface
|
||||
final class TreeSourceInformation implements TreeSourceInformationInterface
|
||||
{
|
||||
/**
|
||||
* @var TreeCollectionSourceInterface
|
||||
@@ -36,6 +36,9 @@ final class TreeSourceService extends AbstractSourceService implements TreeSourc
|
||||
*/
|
||||
private $leaves;
|
||||
|
||||
/**
|
||||
* @param TreeCollectionSource $source
|
||||
*/
|
||||
public function __construct(TreeCollectionSource $source)
|
||||
{
|
||||
$this->source = $source;
|
||||
@@ -44,6 +47,11 @@ final class TreeSourceService extends AbstractSourceService implements TreeSourc
|
||||
$this->basicSort();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SourceInterface $member
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function sortMember(SourceInterface $member): bool
|
||||
{
|
||||
if ($member instanceof TreeCollectionSource) {
|
||||
@@ -60,6 +68,11 @@ final class TreeSourceService extends AbstractSourceService implements TreeSourc
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \App\Domain\SourceManagement\TreeSourceInformationInterface::getBranches()
|
||||
*/
|
||||
public function getBranches(): Collection
|
||||
{
|
||||
return $this->branches;
|
||||
@@ -70,7 +83,7 @@ final class TreeSourceService extends AbstractSourceService implements TreeSourc
|
||||
* @todo Remove the getAllBranches use inside the function.
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \App\Domain\SourceManagement\TreeSourceServiceInterface::getAllBranches()
|
||||
* @see \App\Domain\SourceManagement\TreeSourceInformationInterface::getAllBranches()
|
||||
*/
|
||||
public function getAllBranches(): Collection
|
||||
{
|
||||
@@ -82,6 +95,10 @@ final class TreeSourceService extends AbstractSourceService implements TreeSourc
|
||||
return $allBranches;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TreeCollectionSourceInterface $branch
|
||||
* @param ArrayCollection $allBranches
|
||||
*/
|
||||
private function itterateOverBranch(TreeCollectionSourceInterface $branch, ArrayCollection $allBranches): void
|
||||
{
|
||||
foreach ((new self($branch))->getBranches() as $branchBranch) {
|
||||
@@ -94,11 +111,21 @@ final class TreeSourceService extends AbstractSourceService implements TreeSourc
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \App\Domain\SourceManagement\TreeSourceInformationInterface::getLeaves()
|
||||
*/
|
||||
public function getLeaves(): Collection
|
||||
{
|
||||
return $this->leaves;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \App\Domain\SourceManagement\TreeSourceInformationInterface::getAllLeaves()
|
||||
*/
|
||||
public function getAllLeaves(): Collection
|
||||
{
|
||||
$leaves = new ArrayCollection($this->getLeaves()->toArray());
|
@@ -4,7 +4,12 @@ namespace App\Domain\SourceManagement;
|
||||
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
||||
interface TreeSourceServiceInterface
|
||||
/**
|
||||
* Allows to get branches and leaves of a tree.
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface TreeSourceInformationInterface
|
||||
{
|
||||
/**
|
||||
* Delivers the branches of the actual tree back.
|
@@ -22,6 +22,8 @@ interface TemplatePathInformationInterface extends ReloadTypeInterface
|
||||
public function getAtomTemplatePath(): string;
|
||||
|
||||
/**
|
||||
* @todo Check if this is really needed. Otherwise remove it!
|
||||
*
|
||||
* @see RESTResponseType::$choices
|
||||
*
|
||||
* @return string Type of the template
|
||||
|
@@ -4,6 +4,11 @@ namespace App\Domain\UserManagement;
|
||||
|
||||
use App\Entity\UserInterface;
|
||||
|
||||
/**
|
||||
* Offers based on an user variable a user with a source.
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface UserSourceDirectorInterface
|
||||
{
|
||||
/**
|
||||
|
@@ -3,6 +3,10 @@
|
||||
namespace App\Domain\UserManagement;
|
||||
|
||||
/**
|
||||
* Offers UserSourceDirector to be used as a Service.
|
||||
*
|
||||
* @see UserSourceDirector
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface UserSourceDirectorServiceInterface extends UserSourceDirectorInterface
|
||||
|
Reference in New Issue
Block a user