diff --git a/lib/SimpleSAML/Consent/Consent.php b/lib/SimpleSAML/Consent/Consent.php index eff97f64c296fffbedfbe36e7f0ef82ecf9eb383..0865e0fd7a19d3464ae21aeaf9c42bbc2efd65a8 100644 --- a/lib/SimpleSAML/Consent/Consent.php +++ b/lib/SimpleSAML/Consent/Consent.php @@ -122,6 +122,8 @@ class SimpleSAML_Consent_Consent { $targeted_id = $this->getTargetedID($hashed_user_id); $attribute_hash = $this->getAttributeHash(); + + try { // Create a consent storage. $consent_storage = new SimpleSAML_Consent_Storage($this->config); @@ -131,6 +133,7 @@ class SimpleSAML_Consent_Consent { $this->storageerror = true; return false; } + /** * User has given cosent and asked for storing it for later. */ diff --git a/lib/SimpleSAML/Consent/ConsentStorage.php b/lib/SimpleSAML/Consent/ConsentStorage.php index 6ad2097da69c07b59f4b5a60470c11d83f8c6a8e..8b5fe065ca24c901392ba48b0a599e6c21c7a05f 100644 --- a/lib/SimpleSAML/Consent/ConsentStorage.php +++ b/lib/SimpleSAML/Consent/ConsentStorage.php @@ -65,6 +65,22 @@ class SimpleSAML_Consent_Storage { } + + /** + * Lookup consent database for an entry, and update the timestamp. + * + * @return Will return true if consent is stored, and false if consent is not stored. + */ + public function getList($user_id) { + $stmt = $this->dbh->prepare("SELECT * FROM consent WHERE federation_id = ?"); + $stmt->execute(array($user_id)); + + SimpleSAML_Logger::debug('Library - ConsentStorage getList(): Getting list of all consent entries for a user'); + + return $stmt->fetchAll(PDO::FETCH_ASSOC); + } + + /** * Store user consent in database */