From 22ac4064da3f75f68df8bc939e6d5399f57a3ba8 Mon Sep 17 00:00:00 2001 From: "bbaetz%acm.org" <> Date: Thu, 17 Apr 2008 18:26:12 +0000 Subject: Bug 428941 – Allow extension webservices to override LOGIN_EXEMPT r/a=mkanat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bugzilla/WebService.pm | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'Bugzilla/WebService.pm') diff --git a/Bugzilla/WebService.pm b/Bugzilla/WebService.pm index 72994cb65..a2313803d 100755 --- a/Bugzilla/WebService.pm +++ b/Bugzilla/WebService.pm @@ -42,10 +42,24 @@ sub datetime_format { } sub handle_login { - my ($self, $module, $method) = @_; - my $exempt = LOGIN_EXEMPT->{$module}; - return if $exempt && grep { $_ eq $method } @$exempt; + my ($classes, $action, $uri, $method) = @_; + + my $class = $classes->{$uri}; + eval "require $class"; + + return if $class->login_exempt($method); Bugzilla->login; + + return; +} + +# For some methods, we shouldn't call Bugzilla->login before we call them +use constant LOGIN_EXEMPT => { }; + +sub login_exempt { + my ($class, $method) = @_; + + return $class->LOGIN_EXEMPT->{$method}; } 1; -- cgit v1.2.3-24-g4f1b