public function OpignoStatisticsAccess::accessModule in Opigno statistics 8
Same name and namespace in other branches
- 3.x src/Access/OpignoStatisticsAccess.php \Drupal\opigno_statistics\Access\OpignoStatisticsAccess::accessModule()
Checks access for a route with group and module in params.
1 string reference to 'OpignoStatisticsAccess::accessModule'
File
- src/
Access/ OpignoStatisticsAccess.php, line 26
Class
- OpignoStatisticsAccess
- Opigno Statistics Access.
Namespace
Drupal\opigno_statistics\AccessCode
public function accessModule(UserInterface $user, GroupInterface $training, OpignoModule $module) {
$account = \Drupal::currentUser();
// Allow users to view their own profile.
if ($account
->id() === $user
->id()) {
return AccessResult::allowed();
}
return opigno_statistics_group_access($training, 'view statistics', $account);
}