We call this method to set a given user's parameter in the i2b2 SHRINE. We use this method to set the user's authentication method to use Active Directory. |
function i2b2_set_user_param($user_name, $param_name, $param_type, $param_value){ /* * Construct set_role XML call and attach to message_body parent * <pm:set_user_param> * <user_name>snm0</user_name> * <param name="tests" datatype="T" id="123">myvalue2</param> * </pm:set_user_param> * * Returns: Boolean true when user role is set */ global $i2b2_pm_uri, $i2b2_domain, $i2b2_service_account_id, $i2b2_service_account_pw; $request_xml = i2b2_header_xml($i2b2_pm_uri, $i2b2_domain, $i2b2_service_account_id, $i2b2_service_account_pw); $request_xml .= "<pm:set_user_param>"; $request_xml .= " <user_name>$user_name</user_name>"; $request_xml .= " <param name=\"$param_name\" datatype=\"$param_type\">$param_value</param>"; $request_xml .= "</pm:set_user_param>"; $request_xml .= i2b2_footer_xml(); $ch = curl_init($i2b2_pm_uri); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml')); curl_setopt($ch, CURLOPT_POSTFIELDS, "$request_xml"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); log_request($request_xml, $user_name . '-' . __FUNCTION__); return $data; } |