summaryrefslogtreecommitdiffstats
path: root/extensions/MyDashboard/lib/WebService.pm
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2012-11-30 21:03:59 +0100
committerDave Lawrence <dlawrence@mozilla.com>2012-11-30 21:03:59 +0100
commit37c8ef5cb2750f8039f3b26422d5a5c7cfc61f59 (patch)
treec372513c649a32eb0273a4a8b4004b676bdad133 /extensions/MyDashboard/lib/WebService.pm
parentd83a1c136214a5663a09987c48d66f9a527e7798 (diff)
downloadbugzilla-37c8ef5cb2750f8039f3b26422d5a5c7cfc61f59.tar.gz
bugzilla-37c8ef5cb2750f8039f3b26422d5a5c7cfc61f59.tar.xz
Current dashboard work
Diffstat (limited to 'extensions/MyDashboard/lib/WebService.pm')
-rw-r--r--extensions/MyDashboard/lib/WebService.pm48
1 files changed, 48 insertions, 0 deletions
diff --git a/extensions/MyDashboard/lib/WebService.pm b/extensions/MyDashboard/lib/WebService.pm
index 78285ca06..853ef2baf 100644
--- a/extensions/MyDashboard/lib/WebService.pm
+++ b/extensions/MyDashboard/lib/WebService.pm
@@ -11,8 +11,18 @@ use warnings;
use base qw(Bugzilla::WebService);
+use Bugzilla::Constants;
use Bugzilla::Error;
use Bugzilla::Util qw(detaint_natural trick_taint);
+use Bugzilla::WebService::Util qw(validate);
+
+use Bugzilla::Extension::MyDashboard::Queries qw(QUERY_DEFS query_bugs query_flags);
+
+use constant READ_ONLY => qw(
+ prod_comp_search
+ run_bug_query
+ run_flag_query
+);
sub prod_comp_search {
my ($self, $params) = @_;
@@ -80,6 +90,44 @@ sub prod_comp_search {
return { products => $products };
}
+sub run_bug_query {
+ my($self, $params) = @_;
+ my $user = Bugzilla->login(LOGIN_REQUIRED);
+
+ defined $params->{query}
+ || ThrowCodeError('param_required',
+ { function => 'MyDashboard.run_bug_query',
+ param => 'query' });
+
+ my $result;
+ foreach my $qdef (QUERY_DEFS) {
+ next if $qdef->{name} ne $params->{query};
+ my ($bugs, $query_string) = query_bugs($qdef);
+ $query_string =~ s/^POSTDATA=&//;
+ $qdef->{bugs} = $bugs;
+ $qdef->{buffer} = $query_string;
+ $result = $qdef;
+ last;
+ }
+
+ return { result => $result };
+}
+
+sub run_flag_query {
+ my ($self, $params) =@_;
+ my $user = Bugzilla->login(LOGIN_REQUIRED);
+
+ defined $params->{type}
+ || ThrowCodeError('param_required',
+ { function => 'MyDashboard.run_flag_query',
+ param => 'type' });
+
+ my $type = $params->{type};
+ my $results = query_flags($type);
+
+ return { result => { $type => $results }};
+}
+
1;
__END__