Skip to content

Commit

Permalink
Hide attachments in history if user can't see them
Browse files Browse the repository at this point in the history
If user is not allowed to view attachments (i.e. their access level is
lower than $g_view_attachments_threshold), then the history should not
display information about attachments.

Fixes #17744
  • Loading branch information
dregad committed Oct 16, 2014
1 parent d7ff5e1 commit c2e2bf1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/history_api.php
Expand Up @@ -185,6 +185,7 @@ function history_get_raw_events_array( $p_bug_id, $p_user_id = null ) {

$t_private_bugnote_visible = access_has_bug_level( config_get( 'private_bugnote_threshold' ), $p_bug_id, $t_user_id );
$t_tag_view_threshold = config_get( 'tag_view_threshold' );
$t_view_attachments_threshold = config_get( 'view_attachments_threshold' );
$t_show_monitor_list_threshold = config_get( 'show_monitor_list_threshold' );
$t_show_handler_threshold = config_get( 'view_handler_threshold' );

Expand Down Expand Up @@ -238,6 +239,13 @@ function history_get_raw_events_array( $p_bug_id, $p_user_id = null ) {
}
}

# attachments
if( $v_type == FILE_ADDED || $v_type == FILE_DELETED ) {
if( !access_has_bug_level( $t_view_attachments_threshold, $p_bug_id, $t_user_id ) ) {
continue;
}
}

# monitoring
if( $v_type == BUG_MONITOR || $v_type == BUG_UNMONITOR ) {
if( !access_has_bug_level( $t_show_monitor_list_threshold, $p_bug_id, $t_user_id ) ) {
Expand Down

0 comments on commit c2e2bf1

Please sign in to comment.