summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2015-10-16 00:58:09 +0200
committerDylan William Hardison <dylan@hardison.net>2015-10-16 00:58:09 +0200
commita0fcc8ff20fe57bf442402ba227954ffb33a2175 (patch)
tree9a3ee457971d8c8654d1a085d2c7261b54535621 /Bugzilla
parentb21167f4de2d29d7ce4a7cd07266783032099568 (diff)
downloadbugzilla-a0fcc8ff20fe57bf442402ba227954ffb33a2175.tar.gz
bugzilla-a0fcc8ff20fe57bf442402ba227954ffb33a2175.tar.xz
Bug 1196626 - log all authenticated requests
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Attachment/PatchReader.pm9
-rw-r--r--Bugzilla/Config/Admin.pm6
-rw-r--r--Bugzilla/Search.pm1
-rw-r--r--Bugzilla/WebService/Bug.pm14
4 files changed, 30 insertions, 0 deletions
diff --git a/Bugzilla/Attachment/PatchReader.pm b/Bugzilla/Attachment/PatchReader.pm
index 1ab14f386..2c1647736 100644
--- a/Bugzilla/Attachment/PatchReader.pm
+++ b/Bugzilla/Attachment/PatchReader.pm
@@ -38,6 +38,9 @@ sub process_diff {
if ($format eq 'raw') {
require Bugzilla::PatchReader::DiffPrinter::raw;
$last_reader->sends_data_to(new Bugzilla::PatchReader::DiffPrinter::raw());
+
+ Bugzilla->log_user_request($attachment->bug_id, $attachment->id, "attachment-get")
+ if Bugzilla->user->id;
# Actually print out the patch.
print $cgi->header(-type => 'text/plain',
-expires => '+3M');
@@ -93,6 +96,12 @@ sub process_interdiff {
my $lc = Bugzilla->localconfig;
my $vars = {};
+ if (Bugzilla->user->id) {
+ foreach my $attachment ($old_attachment, $new_attachment) {
+ Bugzilla->log_user_request($attachment->bug_id, $attachment->id, "attachment-get");
+ }
+ }
+
# Encode attachment data as utf8 if it's going to be displayed in a HTML
# page using the UTF-8 encoding.
if ($format ne 'raw' && Bugzilla->params->{'utf8'}) {
diff --git a/Bugzilla/Config/Admin.pm b/Bugzilla/Config/Admin.pm
index 769e3170b..b0c0bad9a 100644
--- a/Bugzilla/Config/Admin.pm
+++ b/Bugzilla/Config/Admin.pm
@@ -63,6 +63,12 @@ sub get_param_list {
type => 't',
default => 10,
checker => \&check_numeric
+ },
+
+ {
+ name => 'log_user_requests',
+ type => 'b',
+ default => 0,
});
return @param_list;
}
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm
index 46d959c3c..ff0db1baa 100644
--- a/Bugzilla/Search.pm
+++ b/Bugzilla/Search.pm
@@ -787,6 +787,7 @@ sub data {
return $self->{data} if $self->{data};
my $dbh = Bugzilla->dbh;
+ Bugzilla->log_user_request(undef, undef, "search") if Bugzilla->user->id;
# If all fields belong to the 'bugs' table, there is no need to split
# the original query into two pieces. Else we override the 'fields'
# argument to first get bug IDs based on the search criteria defined
diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm
index d0fe8465f..d7a1d8f9b 100644
--- a/Bugzilla/WebService/Bug.pm
+++ b/Bugzilla/WebService/Bug.pm
@@ -458,6 +458,11 @@ sub get {
$self->_add_update_tokens($params, \@bugs, \@hashes);
+ if (Bugzilla->user->id) {
+ foreach my $bug (@bugs) {
+ Bugzilla->log_user_request($bug->id, undef, 'bug-get');
+ }
+ }
return { bugs => \@hashes, faults => \@faults };
}
@@ -1196,6 +1201,7 @@ sub attachments {
}
my %attachments;
+ my @log_attachments;
foreach my $attach (@{Bugzilla::Attachment->new_from_list($attach_ids)}) {
Bugzilla::Bug->check($attach->bug_id);
if ($attach->isprivate && !Bugzilla->user->is_insider) {
@@ -1203,10 +1209,18 @@ sub attachments {
object => 'attachment',
attach_id => $attach->id});
}
+ push @log_attachments, $attach;
+
$attachments{$attach->id} =
$self->_attachment_to_hash($attach, $params);
}
+ if (Bugzilla->user->id) {
+ foreach my $attachment (@log_attachments) {
+ Bugzilla->log_user_request($attachment->bug_id, $attachment->id, "attachment-get");
+ }
+ }
+
return { bugs => \%bugs, attachments => \%attachments };
}