diff options
Diffstat (limited to 'Bugzilla/WebService')
-rw-r--r-- | Bugzilla/WebService/Constants.pm | 1 | ||||
-rw-r--r-- | Bugzilla/WebService/Elastic.pm | 59 | ||||
-rw-r--r-- | Bugzilla/WebService/Server/REST.pm | 1 | ||||
-rw-r--r-- | Bugzilla/WebService/Server/REST/Resources/Elastic.pm | 30 |
4 files changed, 0 insertions, 91 deletions
diff --git a/Bugzilla/WebService/Constants.pm b/Bugzilla/WebService/Constants.pm index 1399513c5..bf3a93fd5 100644 --- a/Bugzilla/WebService/Constants.pm +++ b/Bugzilla/WebService/Constants.pm @@ -290,7 +290,6 @@ sub WS_DISPATCH { 'Product' => 'Bugzilla::WebService::Product', 'Group' => 'Bugzilla::WebService::Group', 'BugUserLastVisit' => 'Bugzilla::WebService::BugUserLastVisit', - 'Elastic' => 'Bugzilla::WebService::Elastic', %hook_dispatch }; return $dispatch; diff --git a/Bugzilla/WebService/Elastic.pm b/Bugzilla/WebService/Elastic.pm deleted file mode 100644 index 3a33a1dba..000000000 --- a/Bugzilla/WebService/Elastic.pm +++ /dev/null @@ -1,59 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Bug Tracking System. -# -# Contributor(s): Marc Schumann <wurblzap@gmail.com> -# Max Kanat-Alexander <mkanat@bugzilla.org> -# Mads Bondo Dydensborg <mbd@dbc.dk> -# Noura Elhawary <nelhawar@redhat.com> - -package Bugzilla::WebService::Elastic; - -use 5.10.1; -use strict; -use warnings; -use base qw(Bugzilla::WebService); - -use Bugzilla; -use Bugzilla::Constants; -use Bugzilla::Error; -use Bugzilla::WebService::Util qw(validate); -use Bugzilla::Util qw(trim detaint_natural trick_taint); - -use constant READ_ONLY => qw( suggest_users ); -use constant PUBLIC_METHODS => qw( suggest_users ); - -sub suggest_users { - my ($self, $params) = @_; - - Bugzilla->switch_to_shadow_db(); - - ThrowCodeError('params_required', { function => 'Elastic.suggest_users', params => ['match'] }) - unless defined $params->{match}; - - ThrowUserError('user_access_by_match_denied') - unless Bugzilla->user->id; - - trick_taint($params->{match}); - my $results = Bugzilla->elastic->suggest_users($params->{match} . ""); - my @users = map { - { - real_name => $self->type(string => $_->{real_name}), - name => $self->type(email => $_->{name}), - } - } @$results; - - return { users => \@users }; -} - -1;
\ No newline at end of file diff --git a/Bugzilla/WebService/Server/REST.pm b/Bugzilla/WebService/Server/REST.pm index 6e1944061..d9381b2c8 100644 --- a/Bugzilla/WebService/Server/REST.pm +++ b/Bugzilla/WebService/Server/REST.pm @@ -29,7 +29,6 @@ use Bugzilla::WebService::Server::REST::Resources::Group; use Bugzilla::WebService::Server::REST::Resources::Product; use Bugzilla::WebService::Server::REST::Resources::User; use Bugzilla::WebService::Server::REST::Resources::BugUserLastVisit; -use Bugzilla::WebService::Server::REST::Resources::Elastic; use List::MoreUtils qw(uniq); use Scalar::Util qw(blessed reftype); diff --git a/Bugzilla/WebService/Server/REST/Resources/Elastic.pm b/Bugzilla/WebService/Server/REST/Resources/Elastic.pm deleted file mode 100644 index 2f7c1eaa4..000000000 --- a/Bugzilla/WebService/Server/REST/Resources/Elastic.pm +++ /dev/null @@ -1,30 +0,0 @@ -# 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. - -package Bugzilla::WebService::Server::REST::Resources::Elastic; - -use 5.10.1; -use strict; -use warnings; - -use Bugzilla::WebService::Constants; -use Bugzilla::WebService::Elastic; - -BEGIN { - *Bugzilla::WebService::Elastic::rest_resources = \&_rest_resources; -}; - -sub _rest_resources { - my $rest_resources = [ - qr{^/elastic/suggest_users$}, { - GET => { method => 'suggest_users' }, - }, - ]; - return $rest_resources; -} - -1; |