]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1023633 - Add a webservice_before_call Hook
authorSimon Green <sgreen@redhat.com>
Fri, 13 Jun 2014 00:42:35 +0000 (10:42 +1000)
committerSimon Green <sgreen@redhat.com>
Fri, 13 Jun 2014 00:42:35 +0000 (10:42 +1000)
r=dkl, a=glob

Bugzilla/WebService/Server.pm
extensions/Example/Extension.pm

index 5ffd965a5295c3367f1796f2fdf9e783c290a53e..89cb1a130ac26842ac9e0328f6c70ecfc2e2a583 100644 (file)
@@ -28,6 +28,10 @@ sub handle_login {
     return if ($class->login_exempt($method) 
                and !defined Bugzilla->input_params->{Bugzilla_login});
     Bugzilla->login();
+
+    Bugzilla::Hook::process(
+        'webservice_before_call',
+        { 'method'  => $method, full_method => $full_method });
 }
 
 sub datetime_format_inbound {
index 5370b0f4c55a5a04de1ad72ae743b84f8b17a380..22a3103c2d328f7b28f096e3dbe9e39ef1f1ce55 100644 (file)
@@ -949,6 +949,20 @@ sub webservice_error_codes {
     $error_map->{'example_my_error'} = 10001;
 }
 
+sub webservice_before_call {
+    my ($self, $args) = @_;
+
+    # This code doesn't actually *do* anything, it's just here to show you
+    # how to use this hook.
+    my $method      = $args->{method};
+    my $full_method = $args->{full_method};
+
+    # Uncomment this line to see a line in your webserver's error log whenever
+    # a webservice call is made
+    #warn "RPC call $full_method made by ",
+    #   Bugzilla->user->login || 'an anonymous user', "\n";
+}
+
 sub webservice_fix_credentials {
     my ($self, $args) = @_;
     my $rpc    = $args->{'rpc'};