Skip to content

Commit

Permalink
Fix access checks in Timeline
Browse files Browse the repository at this point in the history
Fixes #24564
  • Loading branch information
atrol committed Jul 5, 2018
1 parent 5bafb6e commit 1e14941
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions core/history_api.php
Expand Up @@ -353,6 +353,8 @@ function history_get_event_from_row( $p_result, $p_user_id = null, $p_check_acce
}
}

$t_project_id = bug_get_field( $v_bug_id, 'project_id' );

if( $v_type == NORMAL_TYPE ) {
if( !in_array( $v_field_name, columns_get_standard() ) ) {
# check that the item should be visible to the user
Expand All @@ -362,15 +364,18 @@ function history_get_event_from_row( $p_result, $p_user_id = null, $p_check_acce
}
}

if( ( $v_field_name == 'target_version' ) && !access_has_bug_level( config_get( 'roadmap_view_threshold' ), $v_bug_id, $t_user_id ) ) {
if( ( $v_field_name == 'target_version' ) &&
!access_has_bug_level( config_get( 'roadmap_view_threshold', null, $t_user_id, $t_project_id ), $v_bug_id, $t_user_id ) ) {
continue;
}

if( ( $v_field_name == 'due_date' ) && !access_has_bug_level( config_get( 'due_date_view_threshold' ), $v_bug_id, $t_user_id ) ) {
if( ( $v_field_name == 'due_date' ) &&
!access_has_bug_level( config_get( 'due_date_view_threshold', null, $t_user_id, $t_project_id ), $v_bug_id, $t_user_id ) ) {
continue;
}

if( ( $v_field_name == 'handler_id' ) && !access_has_bug_level( config_get( 'view_handler_threshold' ), $v_bug_id, $t_user_id ) ) {
if( ( $v_field_name == 'handler_id' ) &&
!access_has_bug_level( config_get( 'view_handler_threshold', null, $t_user_id, $t_project_id ), $v_bug_id, $t_user_id ) ) {
continue;
}
}
Expand All @@ -383,7 +388,7 @@ function history_get_event_from_row( $p_result, $p_user_id = null, $p_check_acce
continue;
}

if( !access_has_bug_level( config_get( 'private_bugnote_threshold' ), $v_bug_id, $t_user_id ) && ( bugnote_get_field( $v_old_value, 'view_state' ) == VS_PRIVATE ) ) {
if( !access_has_bug_level( config_get( 'private_bugnote_threshold', null, $t_user_id, $t_project_id ), $v_bug_id, $t_user_id ) && ( bugnote_get_field( $v_old_value, 'view_state' ) == VS_PRIVATE ) ) {
continue;
}
}
Expand All @@ -393,22 +398,22 @@ function history_get_event_from_row( $p_result, $p_user_id = null, $p_check_acce
continue;
}

if( !access_has_bug_level( config_get( 'private_bugnote_threshold' ), $v_bug_id, $t_user_id ) && ( bugnote_get_field( $v_new_value, 'view_state' ) == VS_PRIVATE ) ) {
if( !access_has_bug_level( config_get( 'private_bugnote_threshold', null, $t_user_id, $t_project_id ), $v_bug_id, $t_user_id ) && ( bugnote_get_field( $v_new_value, 'view_state' ) == VS_PRIVATE ) ) {
continue;
}
}
}

# tags
if( $v_type == TAG_ATTACHED || $v_type == TAG_DETACHED || $v_type == TAG_RENAMED ) {
if( !access_has_bug_level( config_get( 'tag_view_threshold' ), $v_bug_id, $t_user_id ) ) {
if( !access_has_bug_level( config_get( 'tag_view_threshold', null, $t_user_id, $t_project_id ), $v_bug_id, $t_user_id ) ) {
continue;
}
}

# attachments
if( $v_type == FILE_ADDED || $v_type == FILE_DELETED ) {
if( !access_has_bug_level( config_get( 'view_attachments_threshold' ), $v_bug_id, $t_user_id ) ) {
if( !access_has_bug_level( config_get( 'view_attachments_threshold', null, $t_user_id, $t_project_id ), $v_bug_id, $t_user_id ) ) {
continue;
}
}
Expand Down

0 comments on commit 1e14941

Please sign in to comment.