Commit 569e25c3 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 448391: Bug->create() should make sure the reporter is logged in - Patch by…

Bug 448391: Bug->create() should make sure the reporter is logged in - Patch by Fré©ric Buclin <LpSolit@gmail.com> r/a=mkanat
parent 6c62f841
......@@ -476,7 +476,7 @@ sub run_create_validators {
$params->{cc} = $class->_check_cc($component, $params->{cc});
# Callers cannot set Reporter, currently.
$params->{reporter} = Bugzilla->user->id;
$params->{reporter} = $class->_check_reporter();
$params->{creation_ts} ||= Bugzilla->dbh->selectrow_array('SELECT NOW()');
$params->{delta_ts} = $params->{creation_ts};
......@@ -1358,6 +1358,22 @@ sub _check_rep_platform {
return $platform;
}
sub _check_reporter {
my $invocant = shift;
my $reporter;
if (ref $invocant) {
# You cannot change the reporter of a bug.
$reporter = $invocant->reporter->id;
}
else {
# On bug creation, the reporter is the logged in user
# (meaning that he must be logged in first!).
$reporter = Bugzilla->user->id;
$reporter || ThrowCodeError('invalid_user');
}
return $reporter;
}
sub _check_resolution {
my ($self, $resolution) = @_;
$resolution = trim($resolution);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment