class UserSettingsAccess in Notify 1.0.x
Same name and namespace in other branches
- 8 src/Access/UserSettingsAccess.php \Drupal\notify\Access\UserSettingsAccess
- 2.0.x src/Access/UserSettingsAccess.php \Drupal\notify\Access\UserSettingsAccess
Class UserSettingsAccess.
@package Drupal\notify\Access
Hierarchy
- class \Drupal\notify\Access\UserSettingsAccess
Expanded class hierarchy of UserSettingsAccess
File
- src/
Access/ UserSettingsAccess.php, line 14
Namespace
Drupal\notify\AccessView source
class UserSettingsAccess {
/**
* Checks access for the UserSettings form.
*
* @param \Drupal\Core\Routing\RouteMatchInterface $route_match
* The route match.
* @param \Drupal\Core\Session\AccountInterface $account
* Run access checks for this account.
*
* @return \Drupal\Core\Access\AccessResultInterface
* The access result.
*/
public function access(RouteMatchInterface $route_match, AccountInterface $account) {
$current_user = $route_match
->getParameter('user');
if ($current_user === $account
->id()) {
return AccessResult::allowedIf($account
->hasPermission('access notify'));
}
return AccessResult::allowedIf($account
->hasPermission('administer notify'));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
UserSettingsAccess:: |
public | function | Checks access for the UserSettings form. |