57 if ($this->session_manager->isLoggedIn()) {
61 $this->redirects->setLastForwardFrom();
73 if (!$this->session_manager->isLoggedIn()) {
91 $this->assertAuthenticatedUser();
93 $user = $this->session_manager->getLoggedInUser();
94 if (
$user->isAdmin()) {
98 $this->redirects->setLastForwardFrom();
127 'route' => $this->request->get(
'_route'),
151 if (!$this->session_manager->getIgnoreAccess() && !
$entity->hasAccess(
$user_guid)) {
153 $msg = $this->translator->translate(
'limited_access');
158 'route' => $this->request->get(
'_route'),
165 $msg = $this->translator->translate(
'limited_access');
170 'route' => $this->request->get(
'_route'),
175 if (!
$entity->isEnabled() && !$this->session_manager->getDisabledEntityVisibility()) {
181 'route' => $this->request->get(
'_route'),
190 foreach ([
'owner_guid',
'container_guid'] as $prop) {
195 $parent = $this->assertExists(
$entity->$prop);
196 $this->assertAccessibleEntity($parent,
$user);
205 'route' => $this->request->get(
'_route'),
210 if (
$result instanceof HttpException) {
212 }
else if (
$result ===
false) {
213 throw new HttpException();
231 if (!isset($viewer)) {
232 $viewer = $this->session_manager->getLoggedInUser();
235 if (!$viewer || !$viewer->isAdmin()) {
240 'route' => $this->request->get(
'_route'),
261 $this->assertAuthenticatedUser();
263 $this->redirects->setLastForwardFrom();
269 'route' => $this->request->get(
'_route'),
286 $group =
$group ?? $this->page_owner->getPageOwnerEntity();
291 if (
$group->isToolEnabled($group_tool)) {
295 $ex =
new GroupToolGatekeeperException();
299 'tool' => $group_tool,
312 if ($this->request->isXmlHttpRequest()) {
$guid
Reset an ElggUpgrade.
$params
Saves global plugin settings.
Access collections database service.
Entity table database service.
setParams(array $params=[])
Set params to provide context about the exception.
setRedirectUrl($url)
Set preferred redirect URL If set, a redirect response will be issued.
Thrown when entity can not be found.
Thrown when entity can not be edited or container permissions do not allow it to be written.
Thrown when one of the gatekeepers prevents access.
Thrown when the logged in user is not an admin.
Thrown when the request is not a valid ajax request.
Thrown when one of the gatekeepers prevents access.
Thrown when the not logged in.
Thrown when logged in but this isn't allowed.
assertAuthenticatedUser()
Require a user to be authenticated to with code execution.
assertAccessibleGroup(\ElggGroup $group, ?\ElggUser $user=null)
Validate group content visibility.
assertAuthenticatedAdmin()
Require an admin user to be authenticated to proceed with code execution.
assertXmlHttpRequest()
Require XmlHttpRequest.
assertUnauthenticatedUser()
Require a user to be not authenticated (logged out) to with code execution.
assertExists(int $guid, ?string $type=null, ?string $subtype=null)
Require an entity with a given guid, type and subtype to proceed with code execution.
assertAccessibleEntity(\ElggEntity $entity, ?\ElggUser $user=null, bool $validate_can_edit=false)
Require that authenticated user has access to entity.
__construct(protected SessionManagerService $session_manager, protected HttpRequest $request, protected RedirectService $redirects, protected EntityTable $entities, protected AccessCollections $access, protected Translator $translator, protected PageOwnerService $page_owner)
Constructor.
assertAccessibleUser(\ElggUser $user, ?\ElggUser $viewer=null)
Validate active user account.
assertGroupToolEnabled(string $group_tool, ?\ElggGroup $group=null)
Validate group tool enabled.
Holds page owner related functions.
Handles common tasks when redirecting a request.
elgg_get_site_url()
Get the URL for the current (or specified) site, ending with "/".
const ELGG_IGNORE_ACCESS
elgg_call() flags
const ELGG_SHOW_DISABLED_ENTITIES
_elgg_services()
Get the global service provider.
elgg_call(int $flags, Closure $closure)
Calls a callable autowiring the arguments using public DI services and applying logic based on flags.
if(!elgg_get_config('trash_enabled')) $group
if(parse_url(elgg_get_site_url(), PHP_URL_PATH) !=='/') if(file_exists(elgg_get_root_path() . 'robots.txt'))
Set robots.txt.