Example #1
0
function version_ensure_exists($p_version_id)
{
    if (!version_exists($p_version_id)) {
        error_parameters($p_version_id);
        trigger_error(ERROR_VERSION_NOT_FOUND, ERROR);
    }
}
Example #2
0
/**
 * Delete a version.
 *
 * @param string $p_username  The name of the user trying to delete the version.
 * @param string $p_password  The password of the user.
 * @param integer $p_version_id A version's id
 * @return bool returns true or false depending on the success of the delete action
 */
function mc_project_version_delete($p_username, $p_password, $p_version_id)
{
    $t_user_id = mci_check_login($p_username, $p_password);
    if ($t_user_id === false) {
        return mci_soap_fault_login_failed();
    }
    if (is_blank($p_version_id)) {
        return new soap_fault('Client', '', 'Mandatory field "version_id" was missing');
    }
    if (!version_exists($p_version_id)) {
        return new soap_fault('Client', '', "Version '{$p_version_id}' does not exist.");
    }
    $t_project_id = version_get_field($p_version_id, 'project_id');
    if (!mci_has_readwrite_access($t_user_id, $t_project_id)) {
        return mci_soap_fault_access_denied($t_user_id);
    }
    if (!mci_has_access(config_get('manage_project_threshold'), $t_user_id, $t_project_id)) {
        return mci_soap_fault_access_denied($t_user_id);
    }
    return version_remove($p_version_id);
}
Example #3
0
/** 
 * Delete a version.
 *
 * @param string $p_username  The name of the user trying to delete the version.
 * @param string $p_password  The password of the user.
 * @param integer $p_version_id A version's id
 * @return bool returns true or false depending on the success of the delete action
 */
function mc_project_version_delete($p_username, $p_password, $p_version_id)
{
    $t_user_id = mci_check_login($p_username, $p_password);
    if ($t_user_id === false) {
        return new soap_fault('Client', '', 'Access Denied', 'Username/password combination was incorrect');
    }
    if (!mci_has_administrator_access($t_user_id)) {
        return new soap_fault('Client', '', 'Access Denied', 'User does not have administrator access');
    }
    if (is_blank($p_version_id)) {
        return new soap_fault('Client', '', 'Mandatory field "version_id" was missing');
    }
    if (!version_exists($p_version_id)) {
        return new soap_fault('Client', '', "Version '{$p_version_id}' does not exist.");
    }
    return version_remove($p_version_id);
}
/**
 * Delete a version.
 *
 * @param string  $p_username   The name of the user trying to delete the version.
 * @param string  $p_password   The password of the user.
 * @param integer $p_version_id A version's id.
 * @return boolean returns true or false depending on the success of the delete action
 */
function mc_project_version_delete($p_username, $p_password, $p_version_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 (is_blank($p_version_id)) {
        return SoapObjectsFactory::newSoapFault('Client', 'Mandatory field "version_id" was missing');
    }
    if (!version_exists($p_version_id)) {
        return SoapObjectsFactory::newSoapFault('Client', 'Version \'' . $p_version_id . '\' does not exist.');
    }
    $t_project_id = version_get_field($p_version_id, 'project_id');
    $g_project_override = $t_project_id;
    if (!mci_has_readwrite_access($t_user_id, $t_project_id)) {
        return mci_soap_fault_access_denied($t_user_id);
    }
    if (!mci_has_access(config_get('manage_project_threshold'), $t_user_id, $t_project_id)) {
        return mci_soap_fault_access_denied($t_user_id);
    }
    return version_remove($p_version_id);
}