mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2026-10-30 09:12:09 +00:00
Implemented standart rights for user sources
This commit is contained in:
1 parent
a11296df5b
commit
70a117c927
4 files changed
+62
-3
No files matched your search
@@ -6,6 +6,8 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
use Infinito\Attribut\UserAttribut;
|
||||
use Infinito\Entity\UserInterface;
|
||||
use Infinito\Attribut\PersonIdentitySourceAttribut;
|
||||
use Infinito\Entity\Meta\Right;
|
||||
use Infinito\Domain\UserManagement\UserSourceStandartRightMapInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@@ -31,11 +33,38 @@ class UserSource extends AbstractComplexSource implements UserSourceInterface
|
||||
*/
|
||||
protected $personIdentitySource;
|
||||
|
||||
/**
|
||||
* This function sets the standart rights for a user source.
|
||||
*/
|
||||
private function setStandartRights(): void
|
||||
{
|
||||
foreach (UserSourceStandartRightMapInterface::LAYER_RIGHT_MAP as $layer => $actions) {
|
||||
foreach ($actions as $action) {
|
||||
$law = $this->law;
|
||||
$right = new Right();
|
||||
$right = new Right();
|
||||
$right->setSource($this);
|
||||
$right->setLaw($law);
|
||||
$right->setReciever($this);
|
||||
$right->setLayer($layer);
|
||||
$right->setActionType($action);
|
||||
$rights = $law->getRights();
|
||||
$rights->add($right);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->setStandartRights();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \Infinito\Entity\Source\Complex\UserSourceInterface::hasPersonIdentitySource()
|
||||
*/
|
||||
public function hasPersonIdentitySource(): bool
|
||||
{
|
||||
return isset($this->personIdentitySource);
|
||||
|
||||
Reference in new issue
Block a user