From 59d65f99aecdb529be6121e99124bd6cfb6027b1 Mon Sep 17 00:00:00 2001 From: Martin Haase <martin.haase@daasi.de> Date: Fri, 22 Oct 2010 13:06:46 +0000 Subject: [PATCH] minor mods git-svn-id: https://textgridlab.org/svn/textgrid/trunk/middleware/tgauth@7520 7c539038-3410-0410-b1ec-0f2a7bf1c452 --- .../WebAuthN/PutAttributes.php | 5 +++++ .../WebAuthN/TextGrid-WebAuth.php | 11 +++++------ .../tglib/WebUtils.class.php | 4 +++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/info.textgrid.middleware.tgauth.webauth/WebAuthN/PutAttributes.php b/info.textgrid.middleware.tgauth.webauth/WebAuthN/PutAttributes.php index 26815aa..56b24ee 100755 --- a/info.textgrid.middleware.tgauth.webauth/WebAuthN/PutAttributes.php +++ b/info.textgrid.middleware.tgauth.webauth/WebAuthN/PutAttributes.php @@ -67,6 +67,11 @@ foreach ($attributes as $a) { } } +$file = fopen ("/tmp/xxxUR.log", "w+"); +fwrite ($file, "putting these attrs: ". serialize ($newattributes) ."\n"); +fclose ($file); + + $res = $rbac->setAttributes($newattributes, $Sid, $loginmode ); if ((is_array($res) && $res['success'] == FALSE) || (is_object($res) && $res->result == FALSE)) { echo "something went wrong". serialize($res); diff --git a/info.textgrid.middleware.tgauth.webauth/WebAuthN/TextGrid-WebAuth.php b/info.textgrid.middleware.tgauth.webauth/WebAuthN/TextGrid-WebAuth.php index e3c94bb..42fada0 100644 --- a/info.textgrid.middleware.tgauth.webauth/WebAuthN/TextGrid-WebAuth.php +++ b/info.textgrid.middleware.tgauth.webauth/WebAuthN/TextGrid-WebAuth.php @@ -73,11 +73,10 @@ if (isset ($_SERVER["REMOTE_USER"])) { // this holds for shib, too ); if (!isset ($ldap)) { $ProvidedAttributes = Array(); - if (isset($_SERVER["givenName"])) { $ProvidedAttributes['givenName'] = $_SERVER["givenName"];} - if (isset($_SERVER["sn"])) { $ProvidedAttributes['sn'] = $_SERVER["sn"];} - if (isset($_SERVER["cn"])) { $ProvidedAttributes['cn'] = $_SERVER["cn"];} - if (isset($_SERVER["mail"])) { $ProvidedAttributes['mail'] = $_SERVER["mail"];} - if (isset($_SERVER["o"])) { $ProvidedAttributes['o'] = $_SERVER["o"];} + // this is the list of attributes Shibboleth might give to us except from remote_user + foreach (array ("o", "sn", "givenName", "cn", "mail") as $a) { + if (isset($_SERVER[$a])) { $ProvidedAttributes[$a] = $_SERVER[$a];} + } } } // This is Variant 3: No Session Creation, but just a desire to see (and update) User Attributes @@ -85,7 +84,7 @@ else if (isset ($_REQUEST["Sid"]) && strlen($_REQUEST["Sid"]) > 0 ) { // we might have come directly here using the sid and use an earlier session $Sid = $_REQUEST["Sid"]; } else { - trigger_error("WebAuth does not know what to do, exiting.", E_USER_WARNING); + trigger_error("WebAuth does not know what to do (no login provided, no remote user, and no session Id), exiting.", E_USER_WARNING); exit; } diff --git a/info.textgrid.middleware.tgauth.webauth/tglib/WebUtils.class.php b/info.textgrid.middleware.tgauth.webauth/tglib/WebUtils.class.php index 8294382..78fedd0 100644 --- a/info.textgrid.middleware.tgauth.webauth/tglib/WebUtils.class.php +++ b/info.textgrid.middleware.tgauth.webauth/tglib/WebUtils.class.php @@ -178,8 +178,10 @@ class WebUtils { if (isset ($a->value)) { $oldval = $a->value; } + $providedreadonly = ""; if (isset($attrMap[$a->name]) && isset($providedAttrs[$attrMap[$a->name]])) { $oldval = $providedAttrs[$attrMap[$a->name]]; + $providedreadonly = " readonly=\"readonly\""; } if ($this->isBoolean ($a)) { if ($oldval === "TRUE") { @@ -203,7 +205,7 @@ class WebUtils { $this->formatISO3166list( $a->name, $oldval); echo "</td>\n"; } else { // assume string - echo "<td><input type=\"text\" size=\"50\" name=\"". $a->name . "\" value=\"". $oldval ."\"/></td>\n"; + echo "<td><input type=\"text\" size=\"50\" name=\"". $a->name . "\" value=\"${oldval}\"${providedreadonly}/></td>\n"; } echo "<td><div onmouseover=\"this.innerHTML = '". $a->description ."'\"\n"; echo " onmouseout=\"this.innerHTML = '?'\"> ?</div></td></tr>\n"; -- GitLab