diff --git a/info.textgrid.middleware.tgauth.rbac/rbacSoap/TgExtra.class.php b/info.textgrid.middleware.tgauth.rbac/rbacSoap/TgExtra.class.php index 0bb36d4da8de405b8baa916e5784fcd8ca0f18dc..dd3dc2c6b1c425304f0830d46fe79d236aeb32b4 100755 --- a/info.textgrid.middleware.tgauth.rbac/rbacSoap/TgExtra.class.php +++ b/info.textgrid.middleware.tgauth.rbac/rbacSoap/TgExtra.class.php @@ -1052,6 +1052,7 @@ class TgExtra { // log / xsd:string // name / xsd:string // mail / xsd:string + // organisation / xsd:string // Output: userdetail[] / tns:userDetail // Description // Searches for Names (alternatively mails) and returns matching users. @@ -1064,7 +1065,7 @@ class TgExtra { $result = array(); // keep from returning ALL users ;-) - if (strlen ($inRequest->name) == 0 && strlen ($inRequest->mail) == 0) { + if (strlen ($inRequest->name) == 0 && strlen ($inRequest->mail) == 0 && strlen ($inRequest->organisation) == 0) { return result; } @@ -1075,16 +1076,24 @@ class TgExtra { if (strlen ($inRequest->mail) > 0) { $filter .= "(mail=" . $inRequest->mail . ")"; } + if (strlen ($inRequest->organisation) > 0) { + $filter .= "(o=" . $inRequest->organisation . ")"; + } $filter .= "(!(tgagreesearch=FALSE)))"; $arrUserEntry = $this->connection['user']->search( $this->config->getValue( "authentication", "base" ), $filter, "sub" ); + $file = fopen ("/tmp/xxxUR.log", "w+"); + fwrite ($file, serialize ($arrUserEntry) ."\n"); + fclose ($file); + + for ($i = 0; $i < sizeof( $arrUserEntry ); $i++) { if( isset( $arrUserEntry[$i]) && isset( $arrUserEntry[$i]['dn']) ) { $entry = $arrUserEntry[$i]; $result[] = new userDetail ( - $entry['uid'][0], // ePPN + mb_strtolower ($entry['uid'][0]), // ePPN $entry['cn'][0], // name isset ($entry['mail'][0]) ? $entry['mail'][0] : null, isset ($entry['o'][0]) ? $entry['o'][0]: null, // organisation @@ -1112,7 +1121,7 @@ class TgExtra { // agreeSearch / xsd:boolean // Output: result / xsd:boolean // Description - // Sets the projectFile of a project + // Sets userdetails, either by Webauth or by a call from the Lab // ----------------------------------------------------- public function setName( $inRequest ) { @@ -1136,7 +1145,6 @@ class TgExtra { unset ( $arrModify ); } - // 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"; @@ -1177,6 +1185,65 @@ class TgExtra { } + + + // ----------------------------------------------------- + // Function: provideUserDetails + // Input: auth / xsd:string + // log / xsd:string + // citizenship / xsd:string / mandatory + // personid / xsd:string /optional + // interest / xsd:string /optional + // organisationalunit / xsd:string /optional + // Output: result / xsd:boolean + // Description + // Sets further details, called from the Lab + // ----------------------------------------------------- + public function provideUserDetails ( $inRequest ) { + + $arrModify = Array(); + $filter = ""; + $result = new booleanResponse(); // The return-result + + $ePPN = $this->rbac->sessionUser( $inRequest->auth ); + + $filter = "(" . $this->config->getValue( "authentication", "namingattribute" ) . "=" . $ePPN . ")"; + + $arrUserEntry = $this->connection['user']->search( $this->config->getValue( "authentication", "base" ), $filter, "sub" ); + + if( sizeof( $arrUserEntry ) == 1 && isset( $arrUserEntry[0]) && isset( $arrUserEntry[0]['dn']) ) { + + $entry = $arrUserEntry[0]; + + if (!in_array ("schacPersonalCharacteristics", $entry['objectclass'])) { + $arrModify['objectclass'][] = "schacPersonalCharacteristics"; + ldap_mod_add ($this->connection['user']->getConnection(), $entry['dn'], $arrModify); + unset ( $arrModify ); + } + if (!in_array ("TextGridUser", $entry['objectclass'])) { + $arrModify['objectclass'][] = "TextGridUser"; + ldap_mod_add ($this->connection['user']->getConnection(), $entry['dn'], $arrModify); + unset ( $arrModify ); + } + + if ( strlen($inRequest->citizenship) > 0 ) { $arrModify['schacCountryOfCitizenship'][] = $inRequest->citizenship; } + if ( strlen($inRequest->organisationalunit) > 0 ) { $arrModify['ou'][] = $inRequest->organisationalunit; } + if ( strlen($inRequest->interest) > 0 ) { $arrModify['TGfieldOfInterest'][] = $inRequest->interest; } + if ( strlen($inRequest->personid) > 0 ) { $arrModify['TGidentifierForPerson'][] = $inRequest->personid; } + + $this->connection['user']->modify( $entry['dn'], $arrModify); + + $result->result = true; + + } else { + // no unique user found + $result->result = false; + } + + return $result; + } + + // ----------------------------------------------------- // Function: setProjectFile // Input: auth / xsd:string diff --git a/info.textgrid.middleware.tgauth.rbac/rbacSoap/examples/addMember.php b/info.textgrid.middleware.tgauth.rbac/rbacSoap/examples/addMember.php index 817cb1e5e14261192aab5483b3df56eb3460d961..b9e5bffb717392baf5932dcfaf25818a3fe502a7 100755 --- a/info.textgrid.middleware.tgauth.rbac/rbacSoap/examples/addMember.php +++ b/info.textgrid.middleware.tgauth.rbac/rbacSoap/examples/addMember.php @@ -14,7 +14,7 @@ require_once( "../soapTypes.inc.php" ); // ----------------------------------------------------- // You'll need these services // ----------------------------------------------------- -$soapExtra = new SoapClient( "http://rbac.textgrid.daasi.de/wsdl/tgextra.wsdl" ); +$soapExtra = new SoapClient( "../wsdl/tgextra.wsdl" ); echo "<BODY><HTML>"; diff --git a/info.textgrid.middleware.tgauth.rbac/rbacSoap/examples/getIDs.php b/info.textgrid.middleware.tgauth.rbac/rbacSoap/examples/getIDs.php index 5a790fa913ae1bb6671f99f1881a48c0ae7253e5..f8e6f686c9e84ce6bd2109f4f674fe937a261c11 100755 --- a/info.textgrid.middleware.tgauth.rbac/rbacSoap/examples/getIDs.php +++ b/info.textgrid.middleware.tgauth.rbac/rbacSoap/examples/getIDs.php @@ -32,6 +32,7 @@ if( isset( $_POST['auth'] ) ) { $opReq->auth = $_POST['auth']; $opReq->name = $_POST['name']; $opReq->mail = $_POST['mail']; + $opReq->organisation = $_POST['o']; $opReq->log = ""; echo "<HR/>"; @@ -78,6 +79,7 @@ echo "<FORM action=\"getIDs.php\" method=\"post\" enctype=\"multipart/form-data\ echo "Auth: <INPUT type=\"text\" name=\"auth\" value=\"\"><BR>\n"; echo "Name (optional): <INPUT type=\"text\" name=\"name\" value=\"\"><BR>\n"; echo "Mail (optional): <INPUT type=\"text\" name=\"mail\" value=\"\"><BR>\n"; +echo "Organisation (optional): <INPUT type=\"text\" name=\"o\" value=\"\"><BR>\n"; echo "<INPUT type=\"submit\" value=\"Commit...\">\n"; echo "</FORM>\n"; diff --git a/info.textgrid.middleware.tgauth.rbac/rbacSoap/soapTypes.inc.php b/info.textgrid.middleware.tgauth.rbac/rbacSoap/soapTypes.inc.php index 266202f915aa23f587a77581dfd8c2dd83e6e439..10b6b5cd20cb7800ee48591ae77087341a23d8da 100755 --- a/info.textgrid.middleware.tgauth.rbac/rbacSoap/soapTypes.inc.php +++ b/info.textgrid.middleware.tgauth.rbac/rbacSoap/soapTypes.inc.php @@ -662,7 +662,6 @@ class userDetail { if (!is_null ($inorganisation)) { $this->organisation = $inorganisation;} if (!is_null ($inagreesearch)) { $this->agreesearch = $inagreesearch;} if (!is_null ($inusersupplieddata)) { $this->usersupplieddata = $inusersupplieddata;} - } } diff --git a/info.textgrid.middleware.tgauth.rbac/rbacSoap/wsdl-8081/tgextra.wsdl b/info.textgrid.middleware.tgauth.rbac/rbacSoap/wsdl-8081/tgextra.wsdl index 04a316043421b2494b3504ed63711ec722ad4fa3..a32afb54f8efbc00106ccac17a41d5e80e1b864d 100644 --- a/info.textgrid.middleware.tgauth.rbac/rbacSoap/wsdl-8081/tgextra.wsdl +++ b/info.textgrid.middleware.tgauth.rbac/rbacSoap/wsdl-8081/tgextra.wsdl @@ -425,6 +425,20 @@ </xsd:complexType> </xsd:element> + <!-- #### provideUserDetails #### //--> + <xsd:element name="provideUserDetailsRequest"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="auth" type="xsd:string" minOccurs="1" maxOccurs="1" /> + <xsd:element name="log" type="xsd:string" minOccurs="0" maxOccurs="1" /> + <xsd:element name="citizenship" type="xsd:string" minOccurs="1" maxOccurs="1" /> + <xsd:element name="personid" type="xsd:string" minOccurs="0" maxOccurs="1" /> + <xsd:element name="interest" type="xsd:string" minOccurs="0" maxOccurs="1" /> + <xsd:element name="organisationalunit" type="xsd:boolean" minOccurs="0" maxOccurs="1" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <!-- #### getNames #### //--> <xsd:element name="getNamesRequest"> <xsd:complexType> @@ -915,6 +929,14 @@ <wsdl:part element="tns:booleanResponse" name="setNameOutput" /> </wsdl:message> + <!-- #### provideUserDetails #### //--> + <wsdl:message name="provideUserDetailsRequest"> + <wsdl:part element="tns:provideUserDetailsRequest" name="provideUserDetailsInput" /> + </wsdl:message> + <wsdl:message name="provideUserDetailsResponse"> + <wsdl:part element="tns:booleanResponse" name="provideUserDetailsOutput" /> + </wsdl:message> + <!-- #### getNames #### //--> <wsdl:message name="getNamesRequest"> <wsdl:part element="tns:getNamesRequest" name="getNamesInput" /> @@ -1181,6 +1203,39 @@ <wsdl:output message="tns:setNameResponse" /> </wsdl:operation> + <!-- #### provideUserDetails #### //--> + <wsdl:operation name="provideUserDetails"> + + <wsdl:documentation> + Supply further user-specific information + <ul> + <li><b>Input Parameters</b> provideUserDetailsRequest, with elements + <ul> + <li>auth - String, SessionID of User who wants to set their name</li> + <li>log - String for log information, optional</li> + <li>citizenship - mandatory 2-letter String with code for Country Of Citizenship of the User</li> + <li>personid - optional, an URI or PND reference for the person</li> + <li>interest - optional, Users can list their TextGrid-related research interests</li> + <li>organisationalunit - optional, finer-grained unit of a larger organisation</li> + </ul> + </li> + <li><b>Output Parameters</b> booleanResponse, with element + <ul> + <li>result - boolean, true if operation was successful, + false otherwise</li> + </ul> + </li> + <li><b>Faults</b> + <ul> + </ul> + </li> + </ul> + </wsdl:documentation> + + <wsdl:input message="tns:provideUserDetailsRequest" /> + <wsdl:output message="tns:provideUserDetailsResponse" /> + </wsdl:operation> + <!-- #### getNames #### //--> <wsdl:operation name="getNames"> @@ -2312,6 +2367,13 @@ with that user. <wsdl:output><soap:body use="literal" /></wsdl:output> </wsdl:operation> + <!-- #### provideUserDetails #### //--> + <wsdl:operation name="provideUserDetails"> + <soap:operation soapAction="http://textgrid.info/namespaces/middleware/tgauth/provideUserDetails" /> + <wsdl:input><soap:body use="literal" /></wsdl:input> + <wsdl:output><soap:body use="literal" /></wsdl:output> + </wsdl:operation> + <!-- #### getNames #### //--> <wsdl:operation name="getNames"> <soap:operation soapAction="http://textgrid.info/namespaces/middleware/tgauth/getNames" />