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);
205 $this->
set(
'guid', $user->guid);
206 $this->logged_in_user =
$user;
257 $this->logged_in_user = null;
258 $this->
remove(
'guid');
281 $this->ignore_access = $ignore;
327 if (!$this->
has(
'__elgg_session')) {
328 $this->
set(
'__elgg_session',
_elgg_services()->crypto->getRandomString(22));
374 if (in_array(
$key, array(
'user',
'id',
'name',
'username'))) {
376 if ($this->logged_in_user) {
382 return $this->logged_in_user->guid;
386 return $this->logged_in_user->$key;
395 return $this->
get(
$key);
400 if ($orig_value !==
$value) {
436 if (in_array(
$offset, array(
'user',
'id',
'name',
'username'))) {
459 $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.
__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
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.