Revision: 3054
Author:   olavmrk
Date:     Wed Mar 21 05:28:53 2012
Log:      consent: Use new statistics infrastructure.
http://code.google.com/p/simplesamlphp/source/detail?r=3054

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

=======================================
--- /trunk/modules/consent/lib/Auth/Process/Consent.php Thu Mar 15 06:31:30 2012 +++ /trunk/modules/consent/lib/Auth/Process/Consent.php Wed Mar 21 05:28:53 2012
@@ -180,14 +180,18 @@
$idpmeta = $metadata->getMetaData($idpEntityId, 'saml20-idp-remote');
             $state['Source'] = $idpmeta;
         }
+
+        $statsData = array('spEntityID' => $spEntityId);

         // Do not use consent if disabled
if (isset($state['Source']['consent.disable']) && self::checkDisable($state['Source']['consent.disable'], $spEntityId)) { SimpleSAML_Logger::debug('Consent: Consent disabled for entity ' . $spEntityId . ' with IdP ' . $idpEntityId);
+            SimpleSAML_Stats::log('consent:disabled', $statsData);
             return;
         }
if (isset($state['Destination']['consent.disable']) && self::checkDisable($state['Destination']['consent.disable'], $idpEntityId)) { SimpleSAML_Logger::debug('Consent: Consent disabled for entity ' . $spEntityId . ' with IdP ' . $idpEntityId);
+            SimpleSAML_Stats::log('consent:disabled', $statsData);
             return;
         }

@@ -221,10 +225,12 @@
if ($this->_store->hasConsent($userId, $targetedId, $attributeSet)) {
                     // Consent already given
                     SimpleSAML_Logger::stats('Consent: Consent found');
+                    SimpleSAML_Stats::log('consent:found', $statsData);
                     return;
                 }

                 SimpleSAML_Logger::stats('Consent: Consent notfound');
+                SimpleSAML_Stats::log('consent:notfound', $statsData);

                 $state['consent:store']              = $this->_store;
                 $state['consent:store.userId']       = $userId;
@@ -233,9 +239,11 @@
             } catch (Exception $e) {
SimpleSAML_Logger::error('Consent: Error reading from storage: ' . $e->getMessage());
                 SimpleSAML_Logger::stats('Consent: Failed');
+                SimpleSAML_Stats::log('consent:failed', $statsData);
             }
         } else {
             SimpleSAML_Logger::stats('Consent: No storage');
+            SimpleSAML_Stats::log('consent:nostorage', $statsData);
         }

         $state['consent:focus']               = $this->_focus;
@@ -245,6 +253,7 @@

         // User interaction nessesary. Throw exception on isPassive request
         if (isset($state['isPassive']) && $state['isPassive'] == true) {
+            SimpleSAML_Stats::log('consent:nopassive', $statsData);
             throw new SimpleSAML_Error_NoPassive(
                 'Unable to give consent on passive request.'
             );
=======================================
--- /trunk/modules/consent/www/getconsent.php   Thu Mar 15 06:31:30 2012
+++ /trunk/modules/consent/www/getconsent.php   Wed Mar 21 05:28:53 2012
@@ -41,6 +41,14 @@
     } else {
         SimpleSAML_Logger::stats('consentResponse rememberNot');
     }
+
+    $statsInfo = array(
+        'remember' => array_key_exists('saveconsent', $_REQUEST),
+    );
+    if (isset($state['Destination']['entityid'])) {
+        $statsInfo['spEntityID'] = $state['Destination']['entityid'];
+    }
+    SimpleSAML_Stats::log('consent:accept', $statsInfo);

     if (   array_key_exists('consent:store', $state)
         && array_key_exists('saveconsent', $_REQUEST)
=======================================
--- /trunk/modules/consent/www/noconsent.php    Mon Jan 10 04:34:18 2011
+++ /trunk/modules/consent/www/noconsent.php    Wed Mar 21 05:28:53 2012
@@ -23,6 +23,12 @@
 if (isset($state['Destination']['url.about'])) {
     $aboutService = $state['Destination']['url.about'];
 }
+
+$statsInfo = array();
+if (isset($state['Destination']['entityid'])) {
+    $statsInfo['spEntityID'] = $state['Destination']['entityid'];
+}
+SimpleSAML_Stats::log('consent:reject', $statsInfo);

 $globalConfig = SimpleSAML_Configuration::getInstance();

--
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