added domain logic for permission checks (#1803)

This commit is contained in:
Kevin Papst
2020-07-04 13:29:03 +02:00
committed by GitHub
parent 091740f407
commit 682681afa5
16 changed files with 39 additions and 14 deletions

View File

@@ -354,6 +354,11 @@ class User extends BaseUser implements UserInterface
$team->removeUser($this);
}
public function hasTeamAssignment(): bool
{
return !$this->getTeams()->isEmpty();
}
/**
* @return Collection<Team>
*/
@@ -372,6 +377,11 @@ class User extends BaseUser implements UserInterface
return $team->getTeamLead() === $this;
}
public function canSeeAllData(): bool
{
return $this->isSuperAdmin() || $this->isAdmin();
}
public function isTeamlead(): bool
{
return $this->hasRole(static::ROLE_TEAMLEAD);