From df27c5da7bd1c76db1b2e0a40189f94c0eb259b0 Mon Sep 17 00:00:00 2001
From: Martin Haase <martin.haase@daasi.de>
Date: Thu, 11 Mar 2010 16:18:44 +0000
Subject: [PATCH] corrected return result and logic of setName()

git-svn-id: https://textgridlab.org/svn/textgrid/trunk/middleware/tgauth@5704 7c539038-3410-0410-b1ec-0f2a7bf1c452
---
 .../rbacSoap/TgExtra.class.php                | 21 ++++++++++---------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/info.textgrid.middleware.tgauth.rbac/rbacSoap/TgExtra.class.php b/info.textgrid.middleware.tgauth.rbac/rbacSoap/TgExtra.class.php
index bf040a7..f39e001 100755
--- a/info.textgrid.middleware.tgauth.rbac/rbacSoap/TgExtra.class.php
+++ b/info.textgrid.middleware.tgauth.rbac/rbacSoap/TgExtra.class.php
@@ -1134,23 +1134,24 @@ class TgExtra {
         unset ( $arrModify );
       }
 
-      // once data came from the IdP, the flag will always remain on FALSE and only the agreesearch Flag can be set	
-      if (isset ($entry['tgusersupplieddata']) && $entry['tgusersupplieddata'][0] === "FALSE") {
-        if ( $inRequest->agreeSearch ) { $arrModify['tgagreesearch'][] = "TRUE"; } else { $arrModify['tgagreesearch'][] = "FALSE"; }
-        $this->connection['user']->modify( $entry['dn'], $arrModify);
-        $result->result = true;
-        return $result;
-      }
 
       // only assert that these data are correct if they came from the IdP AND the IdP had sent at least the name (cn or (sn and givenname)) and one mail address
       if( $inRequest->webAuthSecret === $this->config->getValue( "webAuth", "secret" ) && strlen($inRequest->name) > 0 && strlen ($inRequest->mail) > 0  ) {
         $arrModify['tgusersupplieddata'][] = "FALSE";
 
-	// only set the agreesearch flag automatically if it was not there before
+	// only set the agreesearch flag automatically if it was not there before, i.e. on very first login
         if (! isset ($entry['tgagreesearch'] )) {
           $arrModify['tgagreesearch'][] = "TRUE";
         }
-      } else {
+      } elseif (isset ($entry['tgusersupplieddata']) && $entry['tgusersupplieddata'][0] === "FALSE") {
+
+        // once data came from the IdP, the flag will always remain on FALSE and only the agreesearch Flag can be set	
+        if ( $inRequest->agreeSearch ) { $arrModify['tgagreesearch'][] = "TRUE"; } else { $arrModify['tgagreesearch'][] = "FALSE"; }
+        $this->connection['user']->modify( $entry['dn'], $arrModify);
+        $result->result = true;
+        return $result;
+
+      } else  {
 	$arrModify['tgusersupplieddata'][] = "TRUE";
 
 	// only set the agreesearch flag if it came from the user
@@ -1170,7 +1171,7 @@ class TgExtra {
       	$result->result = false;
     }
 
-    return result;
+    return $result;
   }
 
 
-- 
GitLab