summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorbbaetz%student.usyd.edu.au <>2002-02-26 15:13:33 +0100
committerbbaetz%student.usyd.edu.au <>2002-02-26 15:13:33 +0100
commit8e03a8495526725e59ab07586afbb4130ad5f7cd (patch)
treed7faf0eda197e277cede26105763fb78a22b8bcf /Bugzilla
parentaa8bcb0d7a825d53a26e200c52dec2fa2f585ab1 (diff)
downloadbugzilla-8e03a8495526725e59ab07586afbb4130ad5f7cd.tar.gz
bugzilla-8e03a8495526725e59ab07586afbb4130ad5f7cd.tar.xz
Bug 97729 - uploaders need to be able to obsolete their own attachments
r=jake, justdave
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Attachment.pm14
1 files changed, 12 insertions, 2 deletions
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;
}