Revision: 3046
Author:   olavmrk
Date:     Thu Mar 15 06:31:30 2012
Log:      consent: Handle errors when accessing from consent database.
http://code.google.com/p/simplesamlphp/source/detail?r=3046

Modified:
 /trunk/modules/consent/lib/Auth/Process/Consent.php
 /trunk/modules/consent/www/getconsent.php

=======================================
--- /trunk/modules/consent/lib/Auth/Process/Consent.php Tue Mar 13 02:40:25 2012 +++ /trunk/modules/consent/lib/Auth/Process/Consent.php Thu Mar 15 06:31:30 2012
@@ -216,19 +216,24 @@
'Consent: hasConsent() [' . $userId . '|' . $targetedId . '|' .
                 $attributeSet . ']'
             );
-
- if ($this->_store->hasConsent($userId, $targetedId, $attributeSet)) {
-                // Consent already given
-                SimpleSAML_Logger::stats('Consent: Consent found');
-                return;
-            }
-
-            SimpleSAML_Logger::stats('Consent: Consent notfound');
-
-            $state['consent:store']              = $this->_store;
-            $state['consent:store.userId']       = $userId;
-            $state['consent:store.destination']  = $targetedId;
-            $state['consent:store.attributeSet'] = $attributeSet;
+
+            try {
+ if ($this->_store->hasConsent($userId, $targetedId, $attributeSet)) {
+                    // Consent already given
+                    SimpleSAML_Logger::stats('Consent: Consent found');
+                    return;
+                }
+
+                SimpleSAML_Logger::stats('Consent: Consent notfound');
+
+                $state['consent:store']              = $this->_store;
+                $state['consent:store.userId']       = $userId;
+                $state['consent:store.destination']  = $targetedId;
+                $state['consent:store.attributeSet'] = $attributeSet;
+            } catch (Exception $e) {
+ SimpleSAML_Logger::error('Consent: Error reading from storage: ' . $e->getMessage());
+                SimpleSAML_Logger::stats('Consent: Failed');
+            }
         } else {
             SimpleSAML_Logger::stats('Consent: No storage');
         }
=======================================
--- /trunk/modules/consent/www/getconsent.php   Mon Jan 10 04:34:18 2011
+++ /trunk/modules/consent/www/getconsent.php   Thu Mar 15 06:31:30 2012
@@ -56,7 +56,11 @@
             'Consent - saveConsent() : [' . $userId . '|' .
             $targetedId . '|' .  $attributeSet . ']'
         );
-        $store->saveConsent($userId, $targetedId, $attributeSet);
+        try {
+            $store->saveConsent($userId, $targetedId, $attributeSet);
+        } catch (Exception $e) {
+ SimpleSAML_Logger::error('Consent: Error writing to storage: ' . $e->getMessage());
+        }
     }

     SimpleSAML_Auth_ProcessingChain::resumeProcessing($state);

--
You received this message because you are subscribed to the Google Groups 
"simpleSAMLphp commits" group.
To post to this group, send email to simplesamlphp-commits@googlegroups.com.
To unsubscribe from this group, send email to 
simplesamlphp-commits+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/simplesamlphp-commits?hl=en.

Reply via email to