23
use strict;
23
use strict;
24
use base qw(Bugzilla::WebService);
24
use base qw(Bugzilla::WebService);
25
import SOAP::Data qw(type);
27
use Bugzilla::Constants;
26
use Bugzilla::Constants;
28
use Bugzilla::Error;
27
use Bugzilla::Error;
87
# This is done in this fashion in order to produce a stable API.
86
# This is done in this fashion in order to produce a stable API.
88
# The internals of Bugzilla::Bug are not stable enough to just
87
# The internals of Bugzilla::Bug are not stable enough to just
89
# return them directly.
88
# return them directly.
90
my $creation_ts = $self->datetime_format($bug->creation_ts);
91
my $delta_ts = $self->datetime_format($bug->delta_ts);
92
my %item;
89
my %item;
93
$item{'creation_time'} = type('dateTime')->value($creation_ts);
90
$item{'creation_time'} = $self->type('dateTime', $bug->creation_ts);
94
$item{'last_change_time'} = type('dateTime')->value($delta_ts);
91
$item{'last_change_time'} = $self->type('dateTime', $bug->delta_ts);
95
$item{'internals'} = $bug;
92
$item{'internals'} = $bug;
96
$item{'id'} = type('int')->value($bug->bug_id);
93
$item{'id'} = $self->type('int', $bug->bug_id);
97
$item{'summary'} = type('string')->value($bug->short_desc);
94
$item{'summary'} = $self->type('string', $bug->short_desc);
99
if (Bugzilla->params->{'usebugaliases'}) {
96
if (Bugzilla->params->{'usebugaliases'}) {
100
$item{'alias'} = type('string')->value($bug->alias);
97
$item{'alias'} = $self->type('string', $bug->alias);
103
# For API reasons, we always want the value to appear, we just
100
# For API reasons, we always want the value to appear, we just
132
foreach my $changeset (@$activity) {
129
foreach my $changeset (@$activity) {
133
my %bug_history;
130
my %bug_history;
134
$bug_history{when} = type('dateTime')->value(
131
$bug_history{when} = $self->type('dateTime',
135
$self->datetime_format($changeset->{when}));
132
$self->datetime_format($changeset->{when}));
136
$bug_history{who} = type('string')->value($changeset->{who});
133
$bug_history{who} = $self->type('string', $changeset->{who});
137
$bug_history{changes} = [];
134
$bug_history{changes} = [];
138
foreach my $change (@{ $changeset->{changes} }) {
135
foreach my $change (@{ $changeset->{changes} }) {
139
my $attach_id = delete $change->{attachid};
136
my $attach_id = delete $change->{attachid};
140
if ($attach_id) {
137
if ($attach_id) {
141
$change->{attachment_id} = type('int')->value($attach_id);
138
$change->{attachment_id} = $self->type('int', $attach_id);
143
$change->{removed} = type('string')->value($change->{removed});
140
$change->{removed} = $self->type('string', $change->{removed});
144
$change->{added} = type('string')->value($change->{added});
141
$change->{added} = $self->type('string', $change->{added});
145
$change->{field_name} = type('string')->value(
142
$change->{field_name} = $self->type('string',
146
delete $change->{fieldname});
143
delete $change->{fieldname});
147
# This is going to go away in the future from GetBugActivity
144
# This is going to go away in the future from GetBugActivity
148
# so we shouldn't put it in the API.
145
# so we shouldn't put it in the API.
157
# then they get to know which bug activity relates to which value
154
# then they get to know which bug activity relates to which value
158
# they passed
155
# they passed
159
if (Bugzilla->params->{'usebugaliases'}) {
156
if (Bugzilla->params->{'usebugaliases'}) {
160
$item{alias} = type('string')->value($bug->alias);
157
$item{alias} = $self->type('string', $bug->alias);
163
# For API reasons, we always want the value to appear, we just
160
# For API reasons, we always want the value to appear, we just
190
Bugzilla::BugMail::Send($bug->bug_id, { changer => $bug->reporter->login });
187
Bugzilla::BugMail::Send($bug->bug_id, { changer => $bug->reporter->login });
192
return { id => type('int')->value($bug->bug_id) };
189
return { id => $self->type('int', $bug->bug_id) };
195
sub legal_values {
192
sub legal_values {
233
my @result;
230
my @result;
234
foreach my $val (@$values) {
231
foreach my $val (@$values) {
235
push(@result, type('string')->value($val));
232
push(@result, $self->type('string', $val));
238
return { values => \@result };
235
return { values => \@result };
22
use base qw(Bugzilla::WebService);
22
use base qw(Bugzilla::WebService);
23
use Bugzilla::Constants;
23
use Bugzilla::Constants;
24
use Bugzilla::Hook;
24
use Bugzilla::Hook;
25
import SOAP::Data qw(type);
27
use Time::Zone;
26
use Time::Zone;
35
sub version {
34
sub version {
36
return { version => type('string')->value(BUGZILLA_VERSION) };
35
my $self = shift;
36
return { version => $self->type('string', BUGZILLA_VERSION) };
39
sub extensions {
39
sub extensions {
40
my $extensions = Bugzilla::Hook::enabled_plugins();
41
my $extensions = Bugzilla::Hook::enabled_plugins();
41
foreach my $name (keys %$extensions) {
42
foreach my $name (keys %$extensions) {
42
my $info = $extensions->{$name};
43
my $info = $extensions->{$name};
43
foreach my $data (keys %$info)
44
foreach my $data (keys %$info) {
44
{
45
$extensions->{$name}->{$data} =
45
$extensions->{$name}->{$data} = type('string')->value($info->{$data});
46
$self->type('string', $info->{$data});
48
return { extensions => $extensions };
49
return { extensions => $extensions };
51
sub timezone {
52
sub timezone {
52
my $offset = tz_offset();
54
my $offset = tz_offset();
53
$offset = (($offset / 60) / 60) * 100;
55
$offset = (($offset / 60) / 60) * 100;
54
$offset = sprintf('%+05d', $offset);
56
$offset = sprintf('%+05d', $offset);
55
return { timezone => type('string')->value($offset) };
57
return { timezone => $self->type('string', $offset) };
21
use base qw(Bugzilla::WebService);
21
use base qw(Bugzilla::WebService);
22
use Bugzilla::Product;
22
use Bugzilla::Product;
23
use Bugzilla::User;
23
use Bugzilla::User;
24
import SOAP::Data qw(type);
26
##################################################
25
##################################################
27
# Add aliases here for method name compatibility #
26
# Add aliases here for method name compatibility #
63
my @products =
62
my @products =
65
internals => $_,
64
internals => $_,
66
id => type('int')->value($_->id),
65
id => $self->type('int', $_->id),
67
name => type('string')->value($_->name),
66
name => $self->type('string', $_->name),
68
description => type('string')->value($_->description),
67
description => $self->type('string', $_->description),
70
} @requested_accessible;
69
} @requested_accessible;
22
use strict;
22
use strict;
23
use base qw(Bugzilla::WebService);
23
use base qw(Bugzilla::WebService);
25
import SOAP::Data qw(type);
27
use Bugzilla;
25
use Bugzilla;
28
use Bugzilla::Constants;
26
use Bugzilla::Constants;
29
use Bugzilla::Error;
27
use Bugzilla::Error;
63
$cgi->param('Bugzilla_remember', $remember);
61
$cgi->param('Bugzilla_remember', $remember);
65
Bugzilla->login;
63
Bugzilla->login;
66
return { id => type('int')->value(Bugzilla->user->id) };
64
return { id => $self->type('int', Bugzilla->user->id) };
69
sub logout {
67
sub logout {
118
cryptpassword => $password
116
cryptpassword => $password
121
return { id => type('int')->value($user->id) };
119
return { id => $self->type('int', $user->id) };
149
ThrowUserError('user_access_by_match_denied');
147
ThrowUserError('user_access_by_match_denied');
151
@users = map {filter $params, {
149
@users = map {filter $params, {
152
id => type('int')->value($_->id),
150
id => $self->type('int', $_->id),
153
real_name => type('string')->value($_->name),
151
real_name => $self->type('string', $_->name),
154
name => type('string')->value($_->login),
152
name => $self->type('string', $_->login),
155
}} @user_objects;
153
}} @user_objects;
157
return { users => \@users };
155
return { users => \@users };
195
if (Bugzilla->user->in_group('editusers')) {
193
if (Bugzilla->user->in_group('editusers')) {
196
@users =
194
@users =
197
map {filter $params, {
195
map {filter $params, {
198
id => type('int')->value($_->id),
196
id => $self->type('int', $_->id),
199
real_name => type('string')->value($_->name),
197
real_name => $self->type('string', $_->name),
200
name => type('string')->value($_->login),
198
name => $self->type('string', $_->login),
201
email => type('string')->value($_->email),
199
email => $self->type('string', $_->email),
202
can_login => type('boolean')->value(!($_->is_disabled)),
200
can_login => $self->type('boolean', $_->is_disabled ? 0 : 1),
203
email_enabled => type('boolean')->value($_->email_enabled),
201
email_enabled => $self->type('boolean', $_->email_enabled),
204
login_denied_text => type('string')->value($_->disabledtext),
202
login_denied_text => $self->type('string', $_->disabledtext),
205
}} @user_objects;
203
}} @user_objects;
209
@users =
207
@users =
210
map {filter $params, {
208
map {filter $params, {
211
id => type('int')->value($_->id),
209
id => $self->type('int', $_->id),
212
real_name => type('string')->value($_->name),
210
real_name => $self->type('string', $_->name),
213
name => type('string')->value($_->login),
211
name => $self->type('string', $_->login),
214
email => type('string')->value($_->email),
212
email => $self->type('string', $_->email),
215
can_login => type('boolean')->value(!($_->is_disabled)),
213
can_login => $self->type('boolean', $_->is_disabled ? 0 : 1),
216
}} @user_objects;
214
}} @user_objects;