Пример #1
0
/**
 * Get all unreleased (a.k.a. future) versions of a project.
 *
 * @param string  $p_username   The name of the user trying to access the versions.
 * @param string  $p_password   The password of the user.
 * @param integer $p_project_id The id of the project to retrieve the versions for.
 * @return array  representing a ProjectVersionDataArray structure.
 */
function mc_project_get_unreleased_versions($p_username, $p_password, $p_project_id)
{
    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();
    }
    if (!project_exists($p_project_id)) {
        return SoapObjectsFactory::newSoapFault('Client', 'Project \'' . $p_project_id . '\' does not exist.');
    }
    $g_project_override = $p_project_id;
    if (!mci_has_readonly_access($t_user_id, $p_project_id)) {
        return mci_soap_fault_access_denied($t_user_id);
    }
    $t_result = array();
    foreach (version_get_all_rows($p_project_id, VERSION_FUTURE) as $t_version) {
        $t_result[] = mci_project_version_as_array($t_version);
    }
    return $t_result;
}
Пример #2
0
/**
 * Get all unreleased (a.k.a. future) versions of a project.
 *
 * @param string $p_username  The name of the user trying to access the versions.
 * @param string $p_password  The password of the user.
 * @param integer $p_project_id  The id of the project to retrieve the versions for.
 * @return Array  representing a ProjectVersionDataArray structure.
 */
function mc_project_get_unreleased_versions( $p_username, $p_password, $p_project_id ) {
	$t_user_id = mci_check_login( $p_username, $p_password );

	if( $t_user_id === false ) {
		return mci_soap_fault_login_failed();
	}

	if( !project_exists( $p_project_id ) ) {
		return new soap_fault( 'Client', '', "Project '$p_project_id' does not exist." );
	}

	if( !mci_has_readonly_access( $t_user_id, $p_project_id ) ) {
		return mci_soap_fault_access_denied( $t_user_id );
	}

	$t_result = array();

	foreach( version_get_all_rows( $p_project_id, VERSION_FUTURE ) as $t_version )
		$t_result[] = mci_project_version_as_array ( $t_version );

	return $t_result;
}