summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Bugzilla/WebService/Server.pm10
-rw-r--r--extensions/MozReview/Extension.pm2
-rw-r--r--extensions/MozReview/template/en/default/hook/global/user-error-errors.html.tmpl11
3 files changed, 13 insertions, 10 deletions
diff --git a/Bugzilla/WebService/Server.pm b/Bugzilla/WebService/Server.pm
index ba05a64e8..d1e17a950 100644
--- a/Bugzilla/WebService/Server.pm
+++ b/Bugzilla/WebService/Server.pm
@@ -22,10 +22,8 @@ use Bugzilla::Error;
use Bugzilla::Util qw(datetime_from);
use Digest::MD5 qw(md5_base64);
-use Encode;
use Scalar::Util qw(blessed);
use Storable qw(freeze);
-use Sys::Syslog qw(:DEFAULT);
sub handle_login {
my ($self, $class, $method, $full_method) = @_;
@@ -38,13 +36,7 @@ sub handle_login {
}
eval "require $class";
- my $error = $@;
- if ($error) {
- openlog('apache', 'cons,pid', 'local4');
- syslog('notice', '[rpc_error] ' . encode_utf8($error));
- closelog();
- }
- ThrowCodeError('unknown_method', {method => $full_method}) if $error;
+ ThrowCodeError('unknown_method', {method => $full_method}) if $@;
return if ($class->login_exempt($method)
and !defined Bugzilla->input_params->{Bugzilla_login});
Bugzilla->login();
diff --git a/extensions/MozReview/Extension.pm b/extensions/MozReview/Extension.pm
index f16c6008b..621e81f43 100644
--- a/extensions/MozReview/Extension.pm
+++ b/extensions/MozReview/Extension.pm
@@ -100,7 +100,7 @@ sub webservice_before_call {
my $app_id = $getter->app_id;
if ($app_id eq $mozreview_app_id) {
unless (any { $full_method eq $_ } @METHOD_WHITELIST) {
- ThrowCodeError('unknown_method', { method => $full_method });
+ ThrowUserError('forbidden_method', { method => $full_method });
}
}
}
diff --git a/extensions/MozReview/template/en/default/hook/global/user-error-errors.html.tmpl b/extensions/MozReview/template/en/default/hook/global/user-error-errors.html.tmpl
new file mode 100644
index 000000000..4599b8398
--- /dev/null
+++ b/extensions/MozReview/template/en/default/hook/global/user-error-errors.html.tmpl
@@ -0,0 +1,11 @@
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ #
+ # This Source Code Form is "Incompatible With Secondary Licenses", as
+ # defined by the Mozilla Public License, v. 2.0.
+ #%]
+
+[% IF error == "forbidden_method" %]
+ The requested method '[% method FILTER html %]' is not allowed to be called using the current API Key.
+[% END %]