class OpignoStatisticsAccess in Opigno statistics 8
Same name and namespace in other branches
- 3.x src/Access/OpignoStatisticsAccess.php \Drupal\opigno_statistics\Access\OpignoStatisticsAccess
Opigno Statistics Access.
Hierarchy
- class \Drupal\opigno_statistics\Access\OpignoStatisticsAccess
Expanded class hierarchy of OpignoStatisticsAccess
File
- src/
Access/ OpignoStatisticsAccess.php, line 13
Namespace
Drupal\opigno_statistics\AccessView source
class OpignoStatisticsAccess {
/**
* Checks access for a route with group in params.
*/
public function accessGroup(UserInterface $user, GroupInterface $group) {
$account = \Drupal::currentUser();
return opigno_statistics_group_access($group, 'view statistics', $account);
}
/**
* Checks access for a route with group and module in params.
*/
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);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
OpignoStatisticsAccess:: |
public | function | Checks access for a route with group in params. | |
OpignoStatisticsAccess:: |
public | function | Checks access for a route with group and module in params. |