Elgg  Version 3.0
Public Member Functions | Protected Attributes | List of all members
Elgg\Gatekeeper Class Reference

Gatekeeper. More...

Public Member Functions

 __construct (ElggSession $session, HttpRequest $request, RedirectService $redirects, EntityTable $entities, AccessCollections $access, Translator $translator)
 Constructor. More...
 
 assertAuthenticatedUser ()
 Require a user to be authenticated to with code execution. More...
 
 assertUnauthenticatedUser ()
 Require a user to be not authenticated (logged out) to with code execution. More...
 
 assertAuthenticatedAdmin ()
 Require an admin user to be authenticated to proceed with code execution. More...
 
 assertExists ($guid, $type=null, $subtype=null)
 Require an entity with a given guid, type and subtype to proceed with code execution. More...
 
 assertAccessibleEntity (ElggEntity $entity, ElggUser $user=null)
 Require that authenticated user has access to entity. More...
 
 assertAccessibleUser (ElggUser $user, ElggUser $viewer=null)
 Validate active user account. More...
 
 assertAccessibleGroup (ElggGroup $group, ElggUser $user=null)
 Validate group content visibility. More...
 
 assertXmlHttpRequest ()
 Require XmlHttpRequest. More...
 

Protected Attributes

 $session
 
 $request
 
 $redirects
 
 $entities
 
 $access
 
 $translator
 

Detailed Description

Gatekeeper.

Use elgg()->gatekeeper

Definition at line 24 of file Gatekeeper.php.

Constructor & Destructor Documentation

Elgg\Gatekeeper::__construct ( ElggSession  $session,
HttpRequest  $request,
RedirectService  $redirects,
EntityTable  $entities,
AccessCollections  $access,
Translator  $translator 
)

Constructor.

Parameters
ElggSession$sessionSession
HttpRequest$requestHTTP Request
RedirectService$redirectsRedirects Service
EntityTable$entitiesEntity table
AccessCollections$accessAccess collection table
Translator$translatorTranslator

Definition at line 66 of file Gatekeeper.php.

Member Function Documentation

Elgg\Gatekeeper::assertAccessibleEntity ( ElggEntity  $entity,
ElggUser  $user = null 
)

Require that authenticated user has access to entity.

Parameters
ElggEntity$entityEntity
ElggUser$userUser
Returns
void
Exceptions
HttpException

Definition at line 174 of file Gatekeeper.php.

Elgg\Gatekeeper::assertAccessibleGroup ( ElggGroup  $group,
ElggUser  $user = null 
)

Validate group content visibility.

Parameters
ElggGroup$groupGroup entity
ElggUser$userUser entity
Returns
void
Exceptions
GroupGatekeeperException
GatekeeperException

Definition at line 272 of file Gatekeeper.php.

Elgg\Gatekeeper::assertAccessibleUser ( ElggUser  $user,
ElggUser  $viewer = null 
)

Validate active user account.

Parameters
ElggUser$userUser
ElggUser$viewerViewing user
Returns
void
Exceptions
EntityNotFoundException

Definition at line 242 of file Gatekeeper.php.

Elgg\Gatekeeper::assertAuthenticatedAdmin ( )

Require an admin user to be authenticated to proceed with code execution.

Returns
void
Exceptions
GatekeeperException
AdminGatekeeperException

Definition at line 119 of file Gatekeeper.php.

Elgg\Gatekeeper::assertAuthenticatedUser ( )

Require a user to be authenticated to with code execution.

Returns
void
Exceptions
LoggedInGatekeeperException

Definition at line 87 of file Gatekeeper.php.

Elgg\Gatekeeper::assertExists (   $guid,
  $type = null,
  $subtype = null 
)

Require an entity with a given guid, type and subtype to proceed with code execution.

Warning
Returned entity has been retrieved with ignored access, as well including disabled entities. You must validate entity access on the return of this method.
Parameters
int$guidGUID of the entity
string$typeEntity type
string$subtypeEntity subtype
Returns
ElggEntity
Exceptions
EntityNotFoundException
Exception

Definition at line 146 of file Gatekeeper.php.

Elgg\Gatekeeper::assertUnauthenticatedUser ( )

Require a user to be not authenticated (logged out) to with code execution.

Returns
void
Exceptions
LoggedOutGatekeeperException

Definition at line 102 of file Gatekeeper.php.

Elgg\Gatekeeper::assertXmlHttpRequest ( )

Require XmlHttpRequest.

Returns
void
Exceptions
AjaxGatekeeperException

Definition at line 297 of file Gatekeeper.php.

Member Data Documentation

Elgg\Gatekeeper::$access
protected

Definition at line 49 of file Gatekeeper.php.

Elgg\Gatekeeper::$entities
protected

Definition at line 44 of file Gatekeeper.php.

Elgg\Gatekeeper::$redirects
protected

Definition at line 39 of file Gatekeeper.php.

Elgg\Gatekeeper::$request
protected

Definition at line 34 of file Gatekeeper.php.

Elgg\Gatekeeper::$session
protected

Definition at line 29 of file Gatekeeper.php.

Elgg\Gatekeeper::$translator
protected

Definition at line 54 of file Gatekeeper.php.


The documentation for this class was generated from the following file: