From 8e03a8495526725e59ab07586afbb4130ad5f7cd Mon Sep 17 00:00:00 2001 From: "bbaetz%student.usyd.edu.au" <> Date: Tue, 26 Feb 2002 14:13:33 +0000 Subject: Bug 97729 - uploaders need to be able to obsolete their own attachments r=jake, justdave --- Bugzilla/Attachment.pm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Attachment.pm b/Bugzilla/Attachment.pm index 1b6d74062..7416fd589 100644 --- a/Bugzilla/Attachment.pm +++ b/Bugzilla/Attachment.pm @@ -51,17 +51,21 @@ sub list my ($bugid) = @_; + my $in_editbugs = &::UserInGroup("editbugs"); # Retrieve a list of attachments for this bug and write them into an array # of hashes in which each hash represents a single attachment. &::SendSQL(" - SELECT attach_id, creation_ts, mimetype, description, ispatch, isobsolete + SELECT attach_id, creation_ts, mimetype, description, ispatch, + isobsolete, submitter_id FROM attachments WHERE bug_id = $bugid ORDER BY attach_id "); my @attachments = (); while (&::MoreSQLData()) { my %a; - ($a{'attachid'}, $a{'date'}, $a{'contenttype'}, $a{'description'}, $a{'ispatch'}, $a{'isobsolete'}) = &::FetchSQLData(); + my $submitter_id; + ($a{'attachid'}, $a{'date'}, $a{'contenttype'}, $a{'description'}, + $a{'ispatch'}, $a{'isobsolete'}, $submitter_id) = &::FetchSQLData(); # Format the attachment's creation/modification date into a standard # format (YYYY-MM-DD HH:MM) @@ -86,6 +90,12 @@ sub list $a{'statuses'} = \@statuses; &::PopGlobalSQLState(); + # We will display the edit link if the user can edit the attachment; + # ie the are the submitter, or they have canedit. + # Also show the link if the user is not logged in - in that cae, + # They'll be prompted later + $a{'canedit'} = ($::userid == 0 || $submitter_id == $::userid || + $in_editbugs); push @attachments, \%a; } -- cgit v1.2.3-24-g4f1b