From f8a11be3e8ba04c0e1d399793d4aad83f9dcf179 Fri, 23 Sep 2011 11:00:15 +0300 From: Robert Munteanu Date: Fri, 23 Sep 2011 10:56:40 +0300 Subject: [PATCH] SOAP API: Ensure that helper_get_current_project() resolves to the requested project Fixes #13324: Adding or updating issue with mylyn causes error #13 diff --git a/api/soap/mc_issue_api.php b/api/soap/mc_issue_api.php index e99cb0f..05d3f4c 100644 --- a/api/soap/mc_issue_api.php +++ b/api/soap/mc_issue_api.php @@ -508,6 +508,9 @@ * @return integer The id of the created issue. */ function mc_issue_add( $p_username, $p_password, $p_issue ) { + + global $g_project_override; + $t_user_id = mci_check_login( $p_username, $p_password ); if( $t_user_id === false ) { return mci_soap_fault_login_failed(); @@ -516,6 +519,7 @@ $t_project = $p_issue['project']; $t_project_id = mci_get_project_id( $t_project ); + $g_project_override = $t_project_id; // ensure that helper_get_current_project() calls resolve to this project id if( !mci_has_readwrite_access( $t_user_id, $t_project_id ) ) { return mci_soap_fault_access_denied( $t_user_id ); @@ -682,6 +686,8 @@ * @return integer The id of the created issue. */ function mc_issue_update( $p_username, $p_password, $p_issue_id, $p_issue ) { + global $g_project_override; + $t_user_id = mci_check_login( $p_username, $p_password ); if( $t_user_id === false ) { return mci_soap_fault_login_failed(); @@ -696,6 +702,8 @@ if( !mci_has_readwrite_access( $t_user_id, $t_project_id ) ) { return mci_soap_fault_access_denied( $t_user_id ); } + + $g_project_override = $t_project_id; // ensure that helper_get_current_project() calls resolve to this project id $t_project_id = mci_get_project_id( $p_issue['project'] ); $t_reporter_id = isset( $p_issue['reporter'] ) ? mci_get_user_id( $p_issue['reporter'] ) : $t_user_id ;