57 $result = $this->storage->start();
69 public function migrate($destroy =
false) {
70 return $this->storage->migrate($destroy);
82 $this->storage->clear();
83 $this->logged_in_user = null;
96 return $this->storage->isStarted();
106 return $this->storage->getId();
117 $this->storage->setId(
$id);
127 return $this->storage->getName();
138 $this->storage->setName(
$name);
149 return $this->storage->get(
$name, $default);
171 return $this->storage->remove(
$name);
194 return $this->storage->has(
$name);
206 if ($current_user != $user) {
207 $this->
set(
'guid', $user->guid);
208 $this->logged_in_user =
$user;
261 $this->logged_in_user = null;
262 $this->
remove(
'guid');
286 $this->ignore_access = $ignore;
332 if (!$this->
has(
'__elgg_session')) {
333 $this->
set(
'__elgg_session',
_elgg_services()->crypto->getRandomString(22));
379 if (in_array(
$key, array(
'user',
'id',
'name',
'username'))) {
381 if ($this->logged_in_user) {
387 return $this->logged_in_user->guid;
391 return $this->logged_in_user->$key;
400 return $this->
get(
$key);
405 if ($orig_value !==
$value) {
441 if (in_array(
$offset, array(
'user',
'id',
'name',
'username'))) {
464 $storage =
new MockArraySessionStorage();
setId($id)
Set the session ID.
setName($name)
Set the session name.
setLoggedInUser(\ElggUser $user)
Sets the logged in user.
has($name)
Has the attribute been defined.
set_ignore_access($ignore=true)
Alias of setIgnoreAccess()
get_ignore_access()
Alias of getIgnoreAccess()
offsetUnset($key)
Unset a value from the cache and the session.
if($guid==elgg_get_logged_in_user_guid()) $name
generateSessionToken()
Adds a token to the session.
migrate($destroy=false)
Migrates the session to a new session id while maintaining session attributes.
getName()
Get the session name.
isLoggedIn()
Returns whether or not the user is currently logged in.
removeLoggedInUser()
Remove the logged in user.
invalidate()
Invalidates the session.
isStarted()
Has the session been started.
getId()
Get the session ID.
start()
Start the session.
getLoggedInUserGuid()
Return the current logged in user by guid.
del($key)
Alias to offsetUnset()
getIgnoreAccess()
Get current ignore access setting.
getLoggedInUser()
Gets the logged in user.
isAdminLoggedIn()
Returns whether or not the viewer is currently logged in and an admin user.
offsetGet($key)
Get a variable from either the session, or if its not in the session attempt to get it from an api ca...
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Log a notice about deprecated use of a function, view, etc.
_elgg_services(\Elgg\Di\ServiceProvider $services=null)
Get the global service provider.
__construct(SessionInterface $storage)
Constructor.
setIgnoreAccess($ignore=true)
Set ignore access.
static getMock()
Get an isolated ElggSession that does not persist between requests.
__isset($key)
Test if property is set either as an attribute or metadata.
if(!$collection_name) $id
http free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
offsetExists($offset)
Return whether the value is set in either the session or the cache.
offsetSet($key, $value)
Set a value, go straight to session.