From 4726923228d810ea0cd1800b17a9244c6f0d8eef Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Mon, 9 Nov 2009 19:15:28 +0000 Subject: Bug 525734: Allow WebService clients to authenticate using Bugzilla_login and Bugzilla_password Patch by Max Kanat-Alexander r=dkl, a=mkanat --- Bugzilla.pm | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'Bugzilla.pm') diff --git a/Bugzilla.pm b/Bugzilla.pm index a373aa801..666b1ec15 100644 --- a/Bugzilla.pm +++ b/Bugzilla.pm @@ -234,6 +234,22 @@ sub cgi { return $class->request_cache->{cgi}; } +sub input_params { + my ($class, $params) = @_; + my $cache = $class->request_cache; + # This is how the WebService and other places set input_params. + if (defined $params) { + $cache->{input_params} = $params; + } + return $cache->{input_params} if defined $cache->{input_params}; + + # Making this scalar makes it a tied hash to the internals of $cgi, + # so if a variable is changed, then it actually changes the $cgi object + # as well. + $cache->{input_params} = $class->cgi->Vars; + return $cache->{input_params}; +} + sub localconfig { my $class = shift; $class->request_cache->{localconfig} ||= read_localconfig(); @@ -647,6 +663,26 @@ The current C object. Note that modules should B be using this in general. Not all Bugzilla actions are cgi requests. Its useful as a convenience method for those scripts/templates which are only use via CGI, though. +=item C + +When running under the WebService, this is a hashref containing the arguments +passed to the WebService method that was called. When running in a normal +script, this is a hashref containing the contents of the CGI parameters. + +Modifying this hashref will modify the CGI parameters or the WebService +arguments (depending on what C currently represents). + +This should be used instead of L in situations where your code +could be being called by either a normal CGI script or a WebService method, +such as during a code hook. + +B When C represents the CGI parameters, any +parameter specified more than once (like C) will appear +as an arrayref in the hash, but any value specified only once will appear +as a scalar. This means that even if a value I appear multiple times, +if it only I appear once, then it will be a scalar in C, +not an arrayref. + =item C C if there is no currently logged in user or if the login code has not -- cgit v1.2.3-24-g4f1b