return $iso_datetime;
}
+sub handle_login {
+ my ($self, $module, $method) = @_;
+ my $exempt = LOGIN_EXEMPT->{$module};
+ return if $exempt && grep { $_ eq $method } @$exempt;
+ Bugzilla->login;
+}
+
package Bugzilla::WebService::XMLRPC::Transport::HTTP::CGI;
use strict;
ERROR_AUTH_NODATA
ERROR_UNIMPLEMENTED
+
+ LOGIN_EXEMPT
);
# This maps the error names in global/*-error.html.tmpl to numbers.
use constant ERROR_UNIMPLEMENTED => 910;
use constant ERROR_GENERAL => 999;
+# For some methods, we shouldn't call Bugzilla->login before we call them.
+# This is a hash--package names pointing to an arrayref of method names.
+use constant LOGIN_EXEMPT => {
+ # Callers may have to know the Bugzilla version before logging in,
+ # even on a requirelogin installation.
+ Bugzilla => ['version'],
+ User => ['offer_account_by_email', 'login'],
+};
+
1;
'User' => 'Bugzilla::WebService::User',
'Product' => 'Bugzilla::WebService::Product',
})
+ ->on_action(\&Bugzilla::WebService::handle_login)
->handle;