Esempio n. 1
0
/**
 * Make sure that the user can reopen the specified bug.
 * Calls access_denied if user has no access to terminate script
 * @see access_can_reopen_bug
 * @param BugData $p_bug Bug to check access against
 * @param int|null $p_user_id integer representing user id, defaults to null to use current user
 * @access public
 */
function access_ensure_can_reopen_bug($p_bug, $p_user_id = null)
{
    if (!access_can_reopen_bug($p_bug, $p_user_id)) {
        access_denied();
    }
}
Esempio n. 2
0
$t_resolve_issue = false;
$t_close_issue = false;
$t_reopen_issue = false;
if ($t_existing_bug->status < $t_resolved_status && $t_updated_bug->status >= $t_resolved_status && $t_updated_bug->status < $t_closed_status) {
    $t_resolve_issue = true;
} else {
    if ($t_existing_bug->status < $t_closed_status && $t_updated_bug->status >= $t_closed_status) {
        $t_close_issue = true;
    } else {
        if ($t_existing_bug->status >= $t_resolved_status && $t_updated_bug->status <= config_get('bug_reopen_status')) {
            $t_reopen_issue = true;
        }
    }
}
$t_reporter_closing = $f_update_type == BUG_UPDATE_TYPE_CLOSE && bug_is_user_reporter($f_bug_id, $t_current_user_id) && access_can_close_bug($t_existing_bug, $t_current_user_id);
$t_reporter_reopening = ($f_update_type == BUG_UPDATE_TYPE_REOPEN || $t_reopen_issue) && bug_is_user_reporter($f_bug_id, $t_current_user_id) && access_can_reopen_bug($t_existing_bug, $t_current_user_id);
if (!$t_reporter_reopening && !$t_reporter_closing) {
    # Ensure that the user has permission to update bugs. This check also factors
    # in whether the user has permission to view private bugs. The
    # $g_limit_reporters option is also taken into consideration.
    access_ensure_bug_level(config_get('update_bug_threshold'), $f_bug_id);
    # Check if the bug is in a read-only state and whether the current user has
    # permission to update read-only bugs.
    if (bug_is_readonly($f_bug_id)) {
        error_parameters($f_bug_id);
        trigger_error(ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR);
    }
}
# If resolving or closing, ensure that all dependant issues have been resolved.
if (($t_resolve_issue || $t_close_issue) && !relationship_can_resolve_bug($f_bug_id)) {
    trigger_error(ERROR_BUG_RESOLVE_DEPENDANTS_BLOCKING, ERROR);
Esempio n. 3
0
/**
 * Print a button to reopen the given bug
 * @param BugData $p_bug Bug object
 * @return null
 */
function html_button_bug_reopen($p_bug)
{
    if (access_can_reopen_bug($p_bug)) {
        $t_reopen_status = config_get('bug_reopen_status', null, null, $p_bug->project_id);
        html_button('bug_change_status_page.php', lang_get('reopen_bug_button'), array('id' => $p_bug->id, 'new_status' => $t_reopen_status, 'reopen_flag' => ON));
    }
}
Esempio n. 4
0
/**
 * Print a button to reopen the given bug
 * @param BugData $p_bug A valid bug object.
 * @return void
 */
function html_button_bug_reopen(BugData $p_bug)
{
    if (access_can_reopen_bug($p_bug)) {
        $t_reopen_status = config_get('bug_reopen_status', null, null, $p_bug->project_id);
        html_button('bug_change_status_page.php', lang_get('reopen_bug_button'), array('id' => $p_bug->id, 'new_status' => $t_reopen_status, 'change_type' => BUG_UPDATE_TYPE_REOPEN));
    }
}