Elgg  Version 5.1
Go to the documentation of this file.
1 <?php
20 function elgg_group_tool_gatekeeper(string $tool_name, int $group_guid = null): void {
21  $group_guid = $group_guid ?? elgg_get_page_owner_guid();
23  $group = get_entity($group_guid);
24  if (!$group instanceof \ElggGroup) {
25  return;
26  }
28  if ($group->isToolEnabled($tool_name)) {
29  return;
30  }
32  $ex = new GroupToolGatekeeperException();
33  $ex->setRedirectUrl($group->getURL());
34  $ex->setParams([
35  'entity' => $group,
36  'tool' => $tool_name,
37  ]);
39  throw $ex;
40 }
50  if (\Elgg\Application::isCli()) {
51  return;
52  }
54  _elgg_services()->urlSigner->assertValid(elgg_get_current_url());
55 }
64 function elgg_gatekeeper(): void {
65  _elgg_services()->gatekeeper->assertAuthenticatedUser();
66 }
76  _elgg_services()->gatekeeper->assertAuthenticatedAdmin();
77 }
99 function elgg_entity_gatekeeper(int $guid, string $type = null, string $subtype = null, bool $validate_can_edit = false): void {
100  $entity = _elgg_services()->gatekeeper->assertExists($guid, $type, $subtype);
101  _elgg_services()->gatekeeper->assertAccessibleEntity($entity, null, $validate_can_edit);
102 }
113  _elgg_services()->gatekeeper->assertXmlHttpRequest();
114 }
Holds all gatekeeper functions.
Validates if the HMAC signature of the current request is valid Issues 403 response if signature is i...
Definition: gatekeepers.php:49
Thrown when the requested group tool isn&#39;t enabled for a group.
elgg_entity_gatekeeper(int $guid, string $type=null, string $subtype=null, bool $validate_can_edit=false)
Can the viewer see this entity?
Definition: gatekeepers.php:99
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it plus any associated interface definition plus the scripts used to control compilation and installation of the executable as a special the source code distributed need not include anything that is normally and so on of the operating system on which the executable unless that component itself accompanies the executable If distribution of executable or object code is made by offering access to copy from a designated then offering equivalent access to copy the source code from the same place counts as distribution of the source even though third parties are not compelled to copy the source along with the object code You may not or distribute the Program except as expressly provided under this License Any attempt otherwise to sublicense or distribute the Program is void
Definition: LICENSE.txt:215
Definition: delete.php:22
Elgg page owner library.
Definition: pageowner.php:12
elgg_group_tool_gatekeeper(string $tool_name, int $group_guid=null)
Checks if a group has a specific tool enabled.
Definition: gatekeepers.php:20
Definition: reset.php:8
get_entity(int $guid)
Loads and returns an entity object from a guid.
Definition: entities.php:67
Returns the current page&#39;s complete URL.
Definition: delete.php:23
Used at the top of a page to mark it as logged in users only.
Definition: gatekeepers.php:64
Get the global service provider.
Definition: elgglib.php:346
Require that the current request be an XHR.
Used at the top of a page to mark it as admin only.
Definition: gatekeepers.php:75
Reset an ElggUpgrade.
Definition: reset.php:6