From 8266ea49bc0dddc0e22a2b621466fc45086f14ae Mon Sep 17 00:00:00 2001
From: Martin Haase <martin.haase@daasi.de>
Date: Thu, 22 Mar 2012 12:51:23 +0000
Subject: [PATCH] fixed Bug that does not set agreeSearch flag to FALSE when it
 was yet unset; fixed warning when user has no roles defined yet

git-svn-id: https://textgridlab.org/svn/textgrid/trunk/middleware/tgauth@12401 7c539038-3410-0410-b1ec-0f2a7bf1c452
---
 .../WebAuthN/PutAttributes.php                        | 11 +++++------
 .../tglib/RBAC.class.php                              |  4 +++-
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/info.textgrid.middleware.tgauth.webauth/WebAuthN/PutAttributes.php b/info.textgrid.middleware.tgauth.webauth/WebAuthN/PutAttributes.php
index 302acb3..ff9ce97 100755
--- a/info.textgrid.middleware.tgauth.webauth/WebAuthN/PutAttributes.php
+++ b/info.textgrid.middleware.tgauth.webauth/WebAuthN/PutAttributes.php
@@ -43,15 +43,14 @@ $attributes = $rbac->getUserAttributes( $Sid );
 $newattributes = array("gnuelpfix"); 
 $thedisplayname = "anonymous";
 
-//phpinfo(); 
 foreach ($attributes as $a) {
   if ($util->isBoolean($a)) {
-    if (isset ( $_REQUEST[$a->name] ) && $_REQUEST[$a->name] === "on" && $a->value !== "TRUE") {
+    if (isset ( $_REQUEST[$a->name] ) && $_REQUEST[$a->name] === "on") {
       $na = new StdClass();
       $na->name = $a->name;
       $na->value = "TRUE";
       $newattributes[] = $na;
-    } else if ($a->value === "TRUE" && !isset ( $_REQUEST[$a->name])) {
+    } else {
       $na = new StdClass();
       $na->name = $a->name;
       $na->value = "FALSE";
@@ -71,10 +70,10 @@ foreach ($attributes as $a) {
     $thedisplayname = $a->value;
   }
 }
+#$file = fopen ("/tmp/xxxPut.log", "w+");
+#fwrite ($file, "putting these attrs: ". serialize ($newattributes) ."\n");
+#fclose ($file); 
 
-$file = fopen ("/tmp/xxxPut.log", "w+");
-fwrite ($file, "putting these attrs: ". serialize ($newattributes) ."\n");
-fclose ($file); 
 
 // write in RBAC
 $res = $rbac->setAttributes($newattributes, $Sid, $loginmode );
diff --git a/info.textgrid.middleware.tgauth.webauth/tglib/RBAC.class.php b/info.textgrid.middleware.tgauth.webauth/tglib/RBAC.class.php
index fd0c1d8..cf01567 100644
--- a/info.textgrid.middleware.tgauth.webauth/tglib/RBAC.class.php
+++ b/info.textgrid.middleware.tgauth.webauth/tglib/RBAC.class.php
@@ -238,7 +238,9 @@ class RBAC {
 		   "detail" => "SOAP FAULT (authorizedRoles)!: " . $f->faultcode . " / " . $f->faultstring . " / " . $f->detail );
       exit;
     }
-    if (is_Array($roleResponse->role)) {
+    if (!isset($roleResponse->role)) {
+      $creReq->roleset = Array();
+    } elseif (is_Array($roleResponse->role)) {
       $creReq->roleset = $roleResponse->role;
     } elseif (is_string($roleResponse->role)) {
       $creReq->roleset = Array($roleResponse->role);
-- 
GitLab