Skip to content
Snippets Groups Projects
Commit 6cb8afc7 authored by Olav Morken's avatar Olav Morken
Browse files

Session: Add getDataOfType function, which retrieves all data of the given...

Session: Add getDataOfType function, which retrieves all data of the given type from the data store.


git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@578 44740490-163a-0410-bde0-09ae8108e29a
parent cb4657bb
No related branches found
No related tags found
No related merge requests found
...@@ -637,6 +637,38 @@ class SimpleSAML_Session { ...@@ -637,6 +637,38 @@ class SimpleSAML_Session {
} }
/**
* This function retrieves all data of the specified type from the data store.
*
* The data will be returned as an associative array with the id of the data as the key, and the data
* as the value of each key. The value will be stored as a copy of the original data. setData must be
* used to update the data.
*
* An empty array will be returned if no data of the given type is found.
*
* @param $type The type of the data.
* @return An associative array with all data of the given type.
*/
public function getDataOfType($type) {
assert('is_string($type)');
if(!is_array($this->dataStore)) {
return array();
}
if(!array_key_exists($type, $this->dataStore)) {
return array();
}
$ret = array();
foreach($this->dataStore[$type] as $id => $info) {
$ret[$id] = $info['data'];
}
return $ret;
}
/** /**
* Load a session from the session handler. * Load a session from the session handler.
* *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment