From 1d5410c712a3cf152c54c597c50894e482bcd0f2 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Tue, 17 Oct 2006 13:20:35 +0000 Subject: Bug 350921: [email_in] Create an email interface that can create a bug in Bugzilla Patch By Max Kanat-Alexander r=colin, r=ghendricks, a=myk --- Bugzilla.pm | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'Bugzilla.pm') diff --git a/Bugzilla.pm b/Bugzilla.pm index ef67643af..374b06e12 100644 --- a/Bugzilla.pm +++ b/Bugzilla.pm @@ -175,6 +175,11 @@ sub user { return request_cache()->{user}; } +sub set_user { + my ($class, $user) = @_; + $class->request_cache->{user} = $user; +} + sub sudoer { my $class = shift; return request_cache()->{sudoer}; @@ -196,6 +201,8 @@ sub sudo_request { sub login { my ($class, $type) = @_; + return Bugzilla->user if Bugzilla->usage_mode == USAGE_MODE_EMAIL; + my $authorizer = new Bugzilla::Auth(); $type = LOGIN_REQUIRED if Bugzilla->cgi->param('GoAheadAndLogIn'); if (!defined $type || $type == LOGIN_NORMAL) { @@ -222,7 +229,7 @@ sub login { !($sudo_target->in_group('bz_sudo_protect')) ) { - request_cache()->{user} = $sudo_target; + Bugzilla->set_user($sudo_target); request_cache()->{sudoer} = $authenticated_user; # And make sure that both users have the same Auth object, # since we never call Auth::login for the sudo target. @@ -231,10 +238,10 @@ sub login { # NOTE: If you want to do any special logging, do it here. } else { - request_cache()->{user} = $authenticated_user; + Bugzilla->set_user($authenticated_user); } - return request_cache()->{user}; + return Bugzilla->user; } sub logout { @@ -303,6 +310,9 @@ sub usage_mode { elsif ($newval == USAGE_MODE_WEBSERVICE) { $class->error_mode(ERROR_MODE_DIE_SOAP_FAULT); } + elsif ($newval == USAGE_MODE_EMAIL) { + $class->error_mode(ERROR_MODE_DIE); + } else { ThrowCodeError('usage_mode_invalid', {'invalid_usage_mode', $newval}); @@ -476,6 +486,12 @@ yet been run. If an sudo session is in progress, the C corresponding to the person who is being impersonated. If no session is in progress, the current C. +=item C + +Allows you to directly set what L will return. You can use this +if you want to bypass L for some reason and directly "log in" +a specific L. Be careful with it, though! + =item C C if there is no currently logged in user, the currently logged in user -- cgit v1.2.3-24-g4f1b