Skip to content

Commit

Permalink
Add method to check if group can see page by group
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas De Keukelaere committed May 31, 2018
1 parent ccd82ac commit 44ff506
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Backend/Modules/Profiles/Domain/Profile/Profile.php
Expand Up @@ -278,6 +278,17 @@ public function registerLogin(): void
$this->lastLogin = new DateTime();
}

public function isInGroup(int $groupId): bool
{
$foundGroups = $this->getRights()->filter(
function (ProfileGroupRight $groupRight) use ($groupId) {
return $groupRight->getGroup()->getId() === $groupId;
}
);

return !$foundGroups->isEmpty();
}

public function toArray(): array
{
return [
Expand Down

0 comments on commit 44ff506

Please sign in to comment.