From 4341b6b1518f0f0cb241bdcfe996e8d61409f5a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no> Date: Fri, 7 Mar 2008 14:53:16 +0000 Subject: [PATCH] Adding a getList() function to the consentstorage git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@375 44740490-163a-0410-bde0-09ae8108e29a --- lib/SimpleSAML/Consent/Consent.php | 3 +++ lib/SimpleSAML/Consent/ConsentStorage.php | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/lib/SimpleSAML/Consent/Consent.php b/lib/SimpleSAML/Consent/Consent.php index eff97f64c..0865e0fd7 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 6ad2097da..8b5fe065c 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 */ -- GitLab