Skip to content
Snippets Groups Projects
Commit 002d4d4b authored by Martin Haase's avatar Martin Haase
Browse files

so far ready, but no slc

git-svn-id: https://textgridlab.org/svn/textgrid/trunk/middleware/tgauth@7508 7c539038-3410-0410-b1ec-0f2a7bf1c452
parent 0ac0dd92
No related branches found
No related tags found
No related merge requests found
......@@ -41,19 +41,22 @@ $thedisplayname = "anonymous";
//phpinfo();
foreach ($attributes as $a) {
if ($util->isBoolean($a)) {
if (isset ( $_REQUEST[$a->name])) {
if (isset ( $_REQUEST[$a->name]) && $_REQUEST[$a->name] == TRUE) {
$na = new StdClass();
$na->name = $a->name;
$na->value = TRUE;
$na->value = "TRUE";
$newattributes[] = $na;
} else {
$na = new StdClass();
$na->name = $a->name;
$na->value = FALSE;
$na->value = "FALSE";
$newattributes[] = $na;
}
} else if (isset ( $_REQUEST[$a->name]) && !isset ($a->value)
|| ( isset( $a->value) && !$_REQUEST[$a->name] === $a->value)) {
} else if (isset ( $_REQUEST[$a->name])
&& strlen($_REQUEST[$a->name]) > 0
&& (!isset ($a->value)
|| ( isset( $a->value)
&& !($_REQUEST[$a->name] === $a->value)))) {
$na = new StdClass();
$na->name = $a->name;
$na->value = $_REQUEST[$a->name];
......@@ -62,9 +65,6 @@ foreach ($attributes as $a) {
if ($a->name === "displayname" && isset ($a->value)) { // set Display Name
$thedisplayname = $a->value;
}
if ($na->name === "displayname") { // Overwrite if set anew
$thedisplayname = $na->value;
}
}
$res = $rbac->setAttributes($newattributes, $Sid, $loginmode );
......
......@@ -45,7 +45,7 @@ if (isset ($_REQUEST["loginname"]) && strlen($_REQUEST["loginname"]) > 0
// Variant 2: Shibboleth gave us the right REMOTE_USER.
// We create a Session here, also vor Variant1
// We create a Session here, also for Variant1
if (isset ($_SERVER["REMOTE_USER"])) { // this holds for shib, too
// now creating session, activating roles, etc, in RBAC
......@@ -81,9 +81,9 @@ if (isset ($_SERVER["REMOTE_USER"])) { // this holds for shib, too
}
}
// This is Variant 3: No Session Creation, but just a desire to see (and update) User Attributes
else if (isset ($_REQUEST["sid"]) && strlen($_REQUEST["sid"]) > 0 ) {
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"];
$Sid = $_REQUEST["id"];
} else {
trigger_error("WebAuth does not know what to do, exiting.", E_USER_WARNING);
exit;
......@@ -101,10 +101,10 @@ if ($rbac->enoughUserAttributes( $Sid ) && isset ($_SERVER["REMOTE_USER"])) {
$CSResult["rbachash"],
array("slcmode" => FALSE) // SLCs only via Shibboleth
);
$rbac->updateAttributes ( $ProvidedAttributes, $AttributeMap ); // not vital and second-order
$rbac->updateAttributes ( $ProvidedAttributes, $AttributeMap, $Sid ); // not vital and second-order
} else {
// now presenting the form, let JavaScript take care for the non-empty-check and the help
// the form will return either displaying the Sid or just a ACK
// the form will return either displaying the Sid or just an ACK
$util->printAttributeForm( $attributes, $ProvidedAttributes, $AttributeMap, $Sid, $authZinstance, $_SERVER["REMOTE_USER"]);
}
......
......@@ -302,9 +302,17 @@ class RBAC {
return TRUE;
}
function updateAttributes ( $map ) {
return TRUE;
function updateAttributes ( $attrs, $map, $Sid ) {
$newattributes = array();
foreach ($map as $name => $value) {
if (isset($attrs[$value])) {
$na = new StdClass();
$na->name = $name;
$na->value = $attrs[$value];
$newattributes[] = $na;
}
}
return $this->setAttributes ($newattributes, $Sid, TRUE);
}
function setAttributes ( $attrs, $Sid, $loginmode ) {
......
......@@ -152,7 +152,7 @@ class WebUtils {
foreach ($existingAttrs as $a) {
if ($a->mandatory) {
echo " if (document.Formular.". $a->name . ".value == \"\") {\n";
echo " alert(\"Please specify your ".$a->displayname .". \\n(".$a->description . ").\");\n";
echo " alert(\"Please specify your ".$a->displayname . "\\n(".$a->description . ").\");\n";
echo " document.Formular.". $a->name . ".focus();\n";
echo " return false;\n";
echo " }\n";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment