3 namespace Drupal\linkchecker\Controller;
5 use Drupal\Core\Session\AccountInterface;
6 use Symfony\Component\HttpFoundation\Request;
9 * Builds user broken link report page.
11 class LinkCheckerUserReportPage {
13 public function content() {
18 * Checks access for a specific request.
20 * @param \Drupal\Core\Session\AccountInterface $account
21 * Run access checks for this account.
23 public function access(AccountInterface $account) {
24 $user = \Drupal::currentUser();
26 // Users with 'access own broken links report' permission can only view their
27 // own report. Users with the 'access broken links report' permission can
28 // view the report for any authenticated user.
29 return AccessResult::allowedIf($account->id() && (($user->id()) == $account->id()) && $account->hasPermission('access own broken links report') || $account->hasPermission('access broken links report'));