Accrual to Clinical Trials
Space shortcuts
Space Tools

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info Box

We call this method to see if a given user has a role in the given i2b2 project. For our User Registration page, a get user method would not return enough information to tell if a user was registered in your i2b2 SHRINE project.

Code Block
titlePHP example. Feel free to user other programming languages
function i2b2_get_role($user_name, $project_id){
	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:get_role>";
	$request_xml .= "	<project_id>$project_id</project_id>";
	$request_xml .= "	<user_name>$user_name</user_name>";
	$request_xml .= "</pm:get_role>";
	$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);
	return $data;