summaryrefslogtreecommitdiffstats
path: root/Bugzilla/WebService/Server
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2014-02-25 22:43:57 +0100
committerDave Lawrence <dlawrence@mozilla.com>2014-02-25 22:43:57 +0100
commitb06a5f44ac35f92a28498c90292eef1735df6f7d (patch)
treef02d19a40d1c499adaa03b86b4bea74844b29e9a /Bugzilla/WebService/Server
parent3ff1cbe6e067833673c6e5d2e64d76613398ed69 (diff)
downloadbugzilla-b06a5f44ac35f92a28498c90292eef1735df6f7d.tar.gz
bugzilla-b06a5f44ac35f92a28498c90292eef1735df6f7d.tar.xz
Bug 972881 - Add hooks to Bugzilla/WebService/Server/REST.pm to allow for extensions to extend and alter REST data
r=glob,a=justdave
Diffstat (limited to 'Bugzilla/WebService/Server')
-rw-r--r--Bugzilla/WebService/Server/REST.pm15
1 files changed, 12 insertions, 3 deletions
diff --git a/Bugzilla/WebService/Server/REST.pm b/Bugzilla/WebService/Server/REST.pm
index f1e59873c..f4bc47c91 100644
--- a/Bugzilla/WebService/Server/REST.pm
+++ b/Bugzilla/WebService/Server/REST.pm
@@ -15,9 +15,10 @@ use parent qw(Bugzilla::WebService::Server::JSONRPC);
use Bugzilla;
use Bugzilla::Constants;
use Bugzilla::Error;
+use Bugzilla::Hook;
+use Bugzilla::Util qw(correct_urlbase html_quote);
use Bugzilla::WebService::Constants;
use Bugzilla::WebService::Util qw(taint_data fix_credentials);
-use Bugzilla::Util qw(correct_urlbase html_quote);
# Load resource modules
use Bugzilla::WebService::Server::REST::Resources::Bug;
@@ -124,6 +125,9 @@ sub response {
$result = $json_data->{result};
}
+ Bugzilla::Hook::process('webservice_rest_response',
+ { rpc => $self, result => \$result, response => $response });
+
# Access Control
$response->header("Access-Control-Allow-Origin", "*");
$response->header("Access-Control-Allow-Headers", "origin, content-type, accept");
@@ -226,8 +230,6 @@ sub _argument_type_check {
taint_data($params);
- Bugzilla->input_params($params);
-
# Now, convert dateTime fields on input.
my $method = $self->bz_method_name;
my $pkg = $self->{dispatch_path}->{$self->path_info};
@@ -262,6 +264,10 @@ sub _argument_type_check {
eval "package $new_class;$isa_string;";
bless $self, $new_class;
+ # Allow extensions to modify the params post login
+ Bugzilla::Hook::process('webservice_rest_request',
+ { rpc => $self, params => $params });
+
if ($params_is_array) {
$params = [$params];
}
@@ -377,6 +383,9 @@ sub _find_resource {
$resources->{$module} = $module->rest_resources;
}
+ Bugzilla::Hook::process('webservice_rest_resources',
+ { rpc => $self, resources => $resources });
+
# Use the resources hash from each module loaded earlier to determine
# which handler to use based on a regex match of the CGI path.
# Also any matches found in the regex will be passed in later to the