Skip to content

Commit 628e937

Browse files
committedJun 2, 2012
Fix #14015: attachment deletion: remove update_bug_threshold check
As reported by Roland Becker (MantisBT developer): Although configuration option allow_delete_own_attachments is set to ON reporters cannot delete their own attachments. After pushing the delete button you get "Access Denied" Issue #14016 implemented correct attachment deletion access control checks against delete_attachments_threshold. We should be using this threshold instead of update_bug_threshold because attachments aren't linked to the core fields of an issue -- they are frequently related to comments (bugnotes) provided by less privileged users. $g_allow_delete_own_attachments should now work again... safely. Conflicts: bug_file_delete.php
1 parent ceafe6f commit 628e937

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed
 

‎api/soap/mc_issue_attachment_api.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,7 @@ function mc_issue_attachment_delete( $p_username, $p_password, $p_issue_attachme
7171

7272
$t_bug_id = file_get_field( $p_issue_attachment_id, 'bug_id' );
7373

74-
# Check access against update_bug_threshold
75-
if( !access_has_bug_level( config_get( 'update_bug_threshold' ), $t_bug_id, $t_user_id ) ) {
76-
return mci_soap_fault_access_denied( $t_user_id );
77-
}
78-
74+
# Perform access control checks
7975
$t_attachment_owner = file_get_field( $f_file_id, 'user_id' );
8076
$t_current_user_is_attachment_owner = $t_attachment_owner == $t_user_id;
8177
# Factor in allow_delete_own_attachments=ON|OFF

‎bug_file_delete.php

-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@
4242
$g_project_override = $t_bug->project_id;
4343
}
4444

45-
access_ensure_bug_level( config_get( 'update_bug_threshold' ), $t_bug_id );
46-
4745
$t_attachment_owner = file_get_field( $f_file_id, 'user_id' );
4846
$t_current_user_is_attachment_owner = $t_attachment_owner == auth_get_current_user_id();
4947
if ( !$t_current_user_is_attachment_owner || ( $t_current_user_is_attachment_owner && !config_get( 'allow_delete_own_attachments' ) ) ) {

0 commit comments

Comments
 (0)