Elgg  Version master
PageOwnerCanEditGatekeeper.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Router\Middleware;
4 
6 
13 
19  protected function assert(\Elgg\Request $request, \Elgg\Router\Route $route): void {
20 
21  // assert we have a logged in user
22  $request->elgg()->gatekeeper->assertAuthenticatedUser();
23 
24  parent::assert($request, $route);
25 
26  if (!$this->page_owner->canEdit()) {
27  throw new EntityPermissionsException();
28  }
29  }
30 }
Thrown when entity can not be edited or container permissions do not allow it to be written.
Request container.
Definition: Request.php:12
Check if the current route page owner can be edited (by the current logged in user)
assert(\Elgg\Request $request, \Elgg\Router\Route $route)
{}
Check if the current route has a page owner entity.
Route Wrapper.
Definition: Route.php:8
Delegates requests to controllers based on the registered configuration.
Definition: Router.php:26
elgg()
Bootstrapping and helper procedural code available for use in Elgg core and plugins.
Definition: elgglib.php:12
$request
Definition: livesearch.php:12