53 if ($this->session_manager->isLoggedIn()) {
57 $this->redirects->setLastForwardFrom();
69 if (!$this->session_manager->isLoggedIn()) {
87 $this->assertAuthenticatedUser();
89 $user = $this->session_manager->getLoggedInUser();
90 if (
$user->isAdmin()) {
94 $this->redirects->setLastForwardFrom();
123 'route' => $this->request->get(
'_route'),
147 if (!$this->session_manager->getIgnoreAccess() && !
$entity->hasAccess(
$user_guid)) {
149 $msg = $this->translator->translate(
'limited_access');
154 'route' => $this->request->get(
'_route'),
161 $msg = $this->translator->translate(
'limited_access');
166 'route' => $this->request->get(
'_route'),
171 if (!
$entity->isEnabled() && !$this->session_manager->getDisabledEntityVisibility()) {
177 'route' => $this->request->get(
'_route'),
186 foreach ([
'owner_guid',
'container_guid'] as $prop) {
191 $parent = $this->assertExists(
$entity->$prop);
192 $this->assertAccessibleEntity($parent,
$user);
201 'route' => $this->request->get(
'_route'),
206 if (
$result instanceof HttpException) {
208 }
else if (
$result ===
false) {
209 throw new HttpException();
227 if (!isset($viewer)) {
228 $viewer = $this->session_manager->getLoggedInUser();
231 if (!$viewer || !$viewer->isAdmin()) {
236 'route' => $this->request->get(
'_route'),
257 $this->assertAuthenticatedUser();
259 $this->redirects->setLastForwardFrom();
265 'route' => $this->request->get(
'_route'),
278 if ($this->request->isXmlHttpRequest()) {
$guid
Reset an ElggUpgrade.
$params
Saves global plugin settings.
Access collections database service.
Entity table database service.
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.
__construct(protected SessionManagerService $session_manager, protected HttpRequest $request, protected RedirectService $redirects, protected EntityTable $entities, protected AccessCollections $access, protected Translator $translator)
Constructor.
assertAccessibleEntity(\ElggEntity $entity, ?\ElggUser $user=null, bool $validate_can_edit=false)
Require that authenticated user has access to entity.
assertAccessibleUser(\ElggUser $user, ?\ElggUser $viewer=null)
Validate active user account.
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.