Mercurial > hg > isophonics-drupal-site
annotate core/modules/tracker/src/Controller/TrackerUserRecent.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 4c8ae668cc8c |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 |
Chris@0 | 3 namespace Drupal\tracker\Controller; |
Chris@0 | 4 |
Chris@0 | 5 use Drupal\Core\Access\AccessResult; |
Chris@0 | 6 use Drupal\Core\Controller\ControllerBase; |
Chris@0 | 7 use Drupal\Core\Session\AccountInterface; |
Chris@0 | 8 use Drupal\user\UserInterface; |
Chris@0 | 9 |
Chris@0 | 10 /** |
Chris@0 | 11 * Controller for tracker.users_recent_content route. |
Chris@0 | 12 */ |
Chris@0 | 13 class TrackerUserRecent extends ControllerBase { |
Chris@0 | 14 |
Chris@0 | 15 /** |
Chris@0 | 16 * Content callback for the tracker.users_recent_content route. |
Chris@0 | 17 */ |
Chris@0 | 18 public function getContent(UserInterface $user) { |
Chris@0 | 19 module_load_include('inc', 'tracker', 'tracker.pages'); |
Chris@0 | 20 return tracker_page($user); |
Chris@0 | 21 } |
Chris@0 | 22 |
Chris@0 | 23 /** |
Chris@0 | 24 * Checks access for the users recent content tracker page. |
Chris@0 | 25 * |
Chris@0 | 26 * @param \Drupal\user\UserInterface $user |
Chris@0 | 27 * The user being viewed. |
Chris@0 | 28 * @param \Drupal\Core\Session\AccountInterface $account |
Chris@0 | 29 * The account viewing the page. |
Chris@0 | 30 * |
Chris@0 | 31 * @return \Drupal\Core\Access\AccessResult |
Chris@0 | 32 * The access result. |
Chris@0 | 33 */ |
Chris@0 | 34 public function checkAccess(UserInterface $user, AccountInterface $account) { |
Chris@0 | 35 return AccessResult::allowedIf($account->isAuthenticated() && $user->id() == $account->id()) |
Chris@0 | 36 ->cachePerUser(); |
Chris@0 | 37 } |
Chris@0 | 38 |
Chris@0 | 39 } |