public static function WebformAccountAccess::checkUserSubmissionsAccess in Webform 6.x
Same name and namespace in other branches
- 8.5 src/Access/WebformAccountAccess.php \Drupal\webform\Access\WebformAccountAccess::checkUserSubmissionsAccess()
Check whether the user can view own submissions.
Parameters
\Drupal\Core\Session\AccountInterface $account: Run access checks for this account.
\Drupal\user\UserInterface $user: The access checked routes' associated user account.
Return value
\Drupal\Core\Access\AccessResultInterface The access result.
1 string reference to 'WebformAccountAccess::checkUserSubmissionsAccess'
File
- src/
Access/ WebformAccountAccess.php, line 79
Class
- WebformAccountAccess
- Defines the custom access control handler for the user accounts.
Namespace
Drupal\webform\AccessCode
public static function checkUserSubmissionsAccess(AccountInterface $account, UserInterface $user) {
$condition = $account
->hasPermission('administer webform') || $account
->hasPermission('administer webform submission') || $account
->hasPermission('view any webform submission') || $account
->hasPermission('access webform submission user') && $account
->id() === $user
->id();
return AccessResult::allowedIf($condition)
->cachePerPermissions();
}