Message-ID: <1438165825.19660.1710813086994.JavaMail.confluence@ip-172-30-4-17.ec2.internal> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_19659_556287364.1710813086992" ------=_Part_19659_556287364.1710813086992 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Purpose
=20We call this method to set a given user's role in the given i2b2 project= .
function i2b= 2_set_role($user_name, $role, $project_id){ =09/* =09 * Construct set_role XML call and attach to message_body parent =09 * <pm:set_role> =09 * <user_name>mem61</user_name> =09 * <role>DATA_AGG</role> =09 * <project_id>ra_mart_test2</project_id> =09 * </pm:set_role> =09 *=20 =09 * Returns: Boolean true when user role is set =09 */ =09global $i2b2_pm_uri, $i2b2_domain, $i2b2_service_account_id, $i2b2_servi= ce_account_pw; =09 =09$request_xml =3D i2b2_header_xml($i2b2_pm_uri, $i2b2_domain, $i2b2_servi= ce_account_id, $i2b2_service_account_pw); =09$request_xml .=3D "<pm:set_role>"; =09$request_xml .=3D "=09<user_name>$user_name</user_name>"; =09$request_xml .=3D "=09<role>$role</role>"; =09$request_xml .=3D "=09<project_id>$project_id</project_id>"; =09$request_xml .=3D "</pm:set_role>"; =09$request_xml .=3D i2b2_footer_xml(); =09 =09$ch =3D curl_init($i2b2_pm_uri); =09curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); =09curl_setopt($ch, CURLOPT_POST, true); =09curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml')); =09curl_setopt($ch, CURLOPT_POSTFIELDS, "$request_xml"); =09curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); =09$data =3D curl_exec($ch); =09 =09log_request($request_xml, $user_name . '-' . __FUNCTION__); =09 =09return $data; =09=09=20 }=20