From: <pka...@us...> - 2009-07-07 10:18:41
|
Revision: 313 http://cse-ip.svn.sourceforge.net/cse-ip/?rev=313&view=rev Author: pkasprzak Date: 2009-07-07 09:59:17 +0000 (Tue, 07 Jul 2009) Log Message: ----------- * Added more (all?) attributes required for addUser() * Made it robust when some account attributes are missing Modified Paths: -------------- trunk/sandbox/lsf-adapter-demo/ILIASClientAdapter/src/AddAccount.bpel Modified: trunk/sandbox/lsf-adapter-demo/ILIASClientAdapter/src/AddAccount.bpel =================================================================== --- trunk/sandbox/lsf-adapter-demo/ILIASClientAdapter/src/AddAccount.bpel 2009-07-03 14:33:22 UTC (rev 312) +++ trunk/sandbox/lsf-adapter-demo/ILIASClientAdapter/src/AddAccount.bpel 2009-07-07 09:59:17 UTC (rev 313) @@ -29,6 +29,12 @@ <variable name="AddUserOut" xmlns:tns="urn:ilUserAdministration" messageType="tns:addUserResponse"/> <variable name="AddUserIn" xmlns:tns="urn:ilUserAdministration" messageType="tns:addUserRequest"/> <variable name="AddAccountIn" xmlns:tns="http://cse.campussource.de/wsdl/ILIASClientAdapter/AddAccount" messageType="tns:AddAccountRequest"/> + + <!-- Constructed later on --> + <variable name="Login" type="xsd:string"/> + <variable name="Password" type="xsd:string"/> + <variable name="EMail" type="xsd:string"/> + </variables> <scope name="AddAccountScope"> @@ -48,7 +54,122 @@ </copy> </assign> - <assign name="setAccountData"> + <!-- Construct login --> + <if> + <condition>$AddAccountIn.account/dt:attribute[dt:name = 'login']/dt:value/text()</condition> + <!-- Login is set in attributes --> + <assign> + <copy> + <from>$AddAccountIn.account/dt:attribute[dt:name = 'login']/dt:value</from> + <to>$Login</to> + </copy> + </assign> + <elseif> + <condition>$AddAccountIn.account/dt:attribute[dt:name = 'firstName']/dt:value/text() and $AddAccountIn.account/dt:attribute[dt:name = 'surname']/dt:value/text()</condition> + <!-- Construct login from firstname + surname --> + <assign> + <copy> + <from>concat($AddAccountIn.account/dt:attribute[dt:name = 'firstName']/dt:value/text(), '.', $AddAccountIn.account/dt:attribute[dt:name = 'surname']/dt:value/text())</from> + <to>$Login</to> + </copy> + </assign> + </elseif> + <else> + <!-- Use attribute of last resort: lsfId --> + <assign> + <copy> + <from>concat('user_', $AddAccountIn.account/dt:attribute[dt:name = 'lsfId']/dt:value)</from> + <to>$Login</to> + </copy> + </assign> + </else> + </if> + + <!-- Construct Password --> + <if> + <condition>$AddAccountIn.account/dt:attribute[dt:name = 'password']/dt:value/text()</condition> + <!-- Password is set in attributes --> + <assign> + <copy> + <from>$AddAccountIn.account/dt:attribute[dt:name = 'password']/dt:value</from> + <to>$Password</to> + </copy> + </assign> + <else> + <!-- Set default password --> + <assign> + <copy> + <from>'test'</from> + <to>$Password</to> + </copy> + </assign> + </else> + </if> + + <!-- Construct EMail --> + <if> + <condition>$AddAccountIn.account/dt:attribute[dt:name = 'emailAddress']/dt:value/text()</condition> + <!-- EMail is set in attributes --> + <assign> + <copy> + <from>$AddAccountIn.account/dt:attribute[dt:name = 'emailAddress']/dt:value/text()</from> + <to>$EMail</to> + </copy> + </assign> + <elseif> + <condition>$AddAccountIn.account/dt:attribute[dt:name = 'firstName']/dt:value/text() and $AddAccountIn.account/dt:attribute[dt:name = 'surname']/dt:value/text()</condition> + <!-- Construct EMail from firstname + surname + dummy-address --> + <assign> + <copy> + <from>concat($AddAccountIn.account/dt:attribute[dt:name = 'firstName']/dt:value/text(), '.', $AddAccountIn.account/dt:attribute[dt:name = 'surname']/dt:value/text(), '@dummy.com')</from> + <to>$EMail</to> + </copy> + </assign> + </elseif> + <else> + <!-- Use attribute of last resort: lsfId --> + <assign> + <copy> + <from>concat('user_', $AddAccountIn.account/dt:attribute[dt:name = 'lsfId']/dt:value, '@dummy.com')</from> + <to>$EMail</to> + </copy> + </assign> + </else> + </if> + + <assign name="setRequiredAccountData"> + <copy> + <from>$Login</from> + <to>$AddUserIn.user_data/login</to> + </copy> + <copy> + <from>$Password</from> + <to>$AddUserIn.user_data/passwd</to> + </copy> + <copy> + <from>$EMail</from> + <to>$AddUserIn.user_data/email</to> + </copy> + <!-- Set timelimit + technical stuff --> + <copy> + <from>7</from> + <to>$AddUserIn.user_data/time_limit_owner</to> + </copy> + <copy> + <from>1</from> + <to>$AddUserIn.user_data/time_limit_unlimited</to> + </copy> + <copy> + <from>1</from> + <to>$AddUserIn.user_data/active</to> + </copy> + <copy> + <from>'en'</from> + <to>$AddUserIn.user_data/user_language</to> + </copy> + </assign> + + <assign name="setOptionalAccountData"> <copy ignoreMissingFromData="yes"> <from>$AddAccountIn.account/dt:attribute[dt:name = 'firstName']/dt:value</from> <to>$AddUserIn.user_data/firstname</to> @@ -71,11 +192,12 @@ <!-- Set SID --> <copy> <from>$AddAccountIn.SID</from> - <to variable="AddUserIn" part="sid"/> + <to>$AddUserIn.sid</to> </copy> + <!-- Set global role --> <copy> - <from>'test'</from> - <to>$AddUserIn.user_data/login</to> + <from>4</from> + <to>$AddUserIn.global_role_id</to> </copy> </assign> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |