Elgg  Version master
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Elgg\SessionManagerService Class Reference

Session manager. More...

Public Member Functions

 __construct (protected\ElggSession $session, protected EventsService $events, protected Translator $translator, protected PersistentLoginService $persistent_login, protected AccessCache $access_cache, protected EntityCache $entity_cache)
 Constructor. More...
 
 getIgnoreAccess ()
 Get current ignore access setting. More...
 
 setIgnoreAccess (bool $ignore=true)
 Set ignore access. More...
 
 getDisabledEntityVisibility ()
 Are disabled entities shown? More...
 
 setDisabledEntityVisibility (bool $show=true)
 Include disabled entities in queries. More...
 
 getDeletedEntityVisibility ()
 Are deleted entities shown? More...
 
 setDeletedEntityVisibility (bool $show=true)
 Include deleted entities in queries. More...
 
 setUserToken (\ElggUser $user=null)
 Set a user specific token in the session for the currently logged in user. More...
 
 validateUserToken (\ElggUser $user)
 Validate the user token stored in the session. More...
 
 login (\ElggUser $user, bool $persistent=false)
 Log in a user. More...
 
 logout ()
 Log the current user out. More...
 
 setLoggedInUser (\ElggUser $user, bool $migrate=null)
 Sets the logged in user. More...
 
 getLoggedInUser ()
 Gets the logged in user. More...
 
 getLoggedInUserGuid ()
 Return the current logged in user by guid. More...
 
 isAdminLoggedIn ()
 Returns whether or not the viewer is currently logged in and an admin user. More...
 
 isLoggedIn ()
 Returns whether or not the user is currently logged in. More...
 
 removeLoggedInUser ()
 Remove the logged in user. More...
 

Protected Member Functions

 generateUserToken (\ElggUser $user)
 Generate a token for a specific user. More...
 

Protected Attributes

bool $ignore_access = false
 
ElggUser $logged_in_user = null
 
bool $show_disabled_entities = false
 
bool $show_deleted_entities = false
 

Detailed Description

Session manager.

Since
5.0

Definition at line 16 of file SessionManagerService.php.

Constructor & Destructor Documentation

Elgg\SessionManagerService::__construct ( protected\ElggSession  $session,
protected EventsService  $events,
protected Translator  $translator,
protected PersistentLoginService  $persistent_login,
protected AccessCache  $access_cache,
protected EntityCache  $entity_cache 
)

Constructor.

Parameters
\ElggSession$sessionthe current session
EventsService$eventsthe events service
Translator$translatorthe translator service
PersistentLoginService$persistent_loginthe persistent login service
AccessCache$access_cachethe access cache
EntityCache$entity_cachethe entity cache

Definition at line 36 of file SessionManagerService.php.

Member Function Documentation

Elgg\SessionManagerService::generateUserToken ( \ElggUser  $user)
protected

Generate a token for a specific user.

Parameters
\ElggUser$userthe user to generate the token for
Returns
string
Since
3.3.25

Definition at line 165 of file SessionManagerService.php.

Elgg\SessionManagerService::getDeletedEntityVisibility ( )

Are deleted entities shown?

Returns
bool
Since
6.0

Definition at line 98 of file SessionManagerService.php.

Elgg\SessionManagerService::getDisabledEntityVisibility ( )

Are disabled entities shown?

Returns
bool

Definition at line 74 of file SessionManagerService.php.

Elgg\SessionManagerService::getIgnoreAccess ( )

Get current ignore access setting.

Returns
bool

Definition at line 51 of file SessionManagerService.php.

Elgg\SessionManagerService::getLoggedInUser ( )

Gets the logged in user.

Returns
|null
Since
1.9

Definition at line 301 of file SessionManagerService.php.

Elgg\SessionManagerService::getLoggedInUserGuid ( )

Return the current logged in user by guid.

Returns
int

Definition at line 310 of file SessionManagerService.php.

Elgg\SessionManagerService::isAdminLoggedIn ( )

Returns whether or not the viewer is currently logged in and an admin user.

Returns
bool

Definition at line 320 of file SessionManagerService.php.

Elgg\SessionManagerService::isLoggedIn ( )

Returns whether or not the user is currently logged in.

Returns
bool

Definition at line 331 of file SessionManagerService.php.

Elgg\SessionManagerService::login ( \ElggUser  $user,
bool  $persistent = false 
)

Log in a user.

Parameters
\ElggUser$userA valid Elgg user object
boolean$persistentShould this be a persistent login?
Returns
void
Exceptions
LoginException
Since
4.3

Definition at line 184 of file SessionManagerService.php.

Elgg\SessionManagerService::logout ( )

Log the current user out.

Returns
bool
Since
4.3

Definition at line 241 of file SessionManagerService.php.

Elgg\SessionManagerService::removeLoggedInUser ( )

Remove the logged in user.

Returns
void
Since
1.9

Definition at line 341 of file SessionManagerService.php.

Elgg\SessionManagerService::setDeletedEntityVisibility ( bool  $show = true)

Include deleted entities in queries.

Parameters
bool$showVisibility status
Returns
bool Previous setting
Since
6.0

Definition at line 110 of file SessionManagerService.php.

Elgg\SessionManagerService::setDisabledEntityVisibility ( bool  $show = true)

Include disabled entities in queries.

Parameters
bool$showVisibility status
Returns
bool Previous setting

Definition at line 85 of file SessionManagerService.php.

Elgg\SessionManagerService::setIgnoreAccess ( bool  $ignore = true)

Set ignore access.

Parameters
bool$ignoreIgnore access
Returns
bool Previous setting

Definition at line 62 of file SessionManagerService.php.

Elgg\SessionManagerService::setLoggedInUser ( \ElggUser  $user,
bool  $migrate = null 
)

Sets the logged in user.

Parameters
\ElggUser$userThe user who is logged in
bool | null$migrateMigrate the session (default: !::isCli())
Returns
void
Since
1.9

Definition at line 275 of file SessionManagerService.php.

Elgg\SessionManagerService::setUserToken ( \ElggUser  $user = null)

Set a user specific token in the session for the currently logged in user.

This will invalidate the session on a password change of the logged in user

Parameters
\ElggUser$userthe user to set the token for (default: logged in user)
Returns
void
Since
3.3.25

Definition at line 127 of file SessionManagerService.php.

Elgg\SessionManagerService::validateUserToken ( \ElggUser  $user)

Validate the user token stored in the session.

Parameters
\ElggUser$userthe user to check for
Returns
void
Exceptions

Definition at line 148 of file SessionManagerService.php.

Member Data Documentation

bool Elgg\SessionManagerService::$ignore_access = false
protected

Definition at line 18 of file SessionManagerService.php.

ElggUser Elgg\SessionManagerService::$logged_in_user = null
protected

Definition at line 20 of file SessionManagerService.php.

bool Elgg\SessionManagerService::$show_deleted_entities = false
protected

Definition at line 24 of file SessionManagerService.php.

bool Elgg\SessionManagerService::$show_disabled_entities = false
protected

Definition at line 22 of file SessionManagerService.php.


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