diff options
author | lpsolit%gmail.com <> | 2008-07-30 04:57:43 +0000 |
---|---|---|
committer | lpsolit%gmail.com <> | 2008-07-30 04:57:43 +0000 |
commit | 569e25c31647d6eedb0c2481c0d69b73c1af091b (patch) | |
tree | 9d1fe501a2e0ed4a6a25eb795c6c252364432088 | |
parent | 6c62f841490783a42ffc837387cdf371c7ab12cb (diff) | |
download | bugs-569e25c31647d6eedb0c2481c0d69b73c1af091b.tar bugs-569e25c31647d6eedb0c2481c0d69b73c1af091b.tar.gz bugs-569e25c31647d6eedb0c2481c0d69b73c1af091b.tar.bz2 bugs-569e25c31647d6eedb0c2481c0d69b73c1af091b.tar.xz bugs-569e25c31647d6eedb0c2481c0d69b73c1af091b.zip |
Bug 448391: Bug->create() should make sure the reporter is logged in - Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=mkanat
-rw-r--r-- | Bugzilla/Bug.pm | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index bade02f68..ff0f2089f 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -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); |