aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2020-01-29 06:50:00 -0800
committerRobin H. Johnson <robbat2@gentoo.org>2020-01-29 06:56:28 -0800
commit976f4aa6d3e82e568149dd58a0197b36641b7b81 (patch)
tree5df93d3bd42ed5eebfce726bdf559d45d2684075 /Bugzilla/WebService/Bugzilla.pm
parentMerge remote-tracking branch 'origin/master' into bugstest (diff)
parentMerge tag 'release-5.0.6' into bugstest (diff)
downloadbugzilla-976f4aa6d3e82e568149dd58a0197b36641b7b81.tar.gz
bugzilla-976f4aa6d3e82e568149dd58a0197b36641b7b81.tar.bz2
bugzilla-976f4aa6d3e82e568149dd58a0197b36641b7b81.zip
Merge branch 'bugstest-5.0.6' into bugstest
Merge my 5.0.6 import changes. This is specifically a merge to make it easier to merge upstream changes again after the code reformatting. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Diffstat (limited to 'Bugzilla/WebService/Bugzilla.pm')
-rw-r--r--Bugzilla/WebService/Bugzilla.pm237
1 files changed, 117 insertions, 120 deletions
diff --git a/Bugzilla/WebService/Bugzilla.pm b/Bugzilla/WebService/Bugzilla.pm
index 848cffd30..f93892068 100644
--- a/Bugzilla/WebService/Bugzilla.pm
+++ b/Bugzilla/WebService/Bugzilla.pm
@@ -20,158 +20,155 @@ use Bugzilla::Util qw(trick_taint);
use DateTime;
# Basic info that is needed before logins
-use constant LOGIN_EXEMPT => {
- parameters => 1,
- timezone => 1,
- version => 1,
-};
+use constant LOGIN_EXEMPT => {parameters => 1, timezone => 1, version => 1,};
use constant READ_ONLY => qw(
- extensions
- parameters
- timezone
- time
- version
+ extensions
+ parameters
+ timezone
+ time
+ version
);
use constant PUBLIC_METHODS => qw(
- extensions
- last_audit_time
- parameters
- time
- timezone
- version
+ extensions
+ last_audit_time
+ parameters
+ time
+ timezone
+ version
);
# Logged-out users do not need to know more than that.
use constant PARAMETERS_LOGGED_OUT => qw(
- maintainer
- requirelogin
+ maintainer
+ requirelogin
);
# These parameters are guessable from the web UI when the user
# is logged in. So it's safe to access them.
use constant PARAMETERS_LOGGED_IN => qw(
- allowemailchange
- attachment_base
- commentonchange_resolution
- commentonduplicate
- cookiepath
- defaultopsys
- defaultplatform
- defaultpriority
- defaultseverity
- duplicate_or_move_bug_status
- emailregexpdesc
- emailsuffix
- letsubmitterchoosemilestone
- letsubmitterchoosepriority
- mailfrom
- maintainer
- maxattachmentsize
- maxlocalattachment
- musthavemilestoneonaccept
- noresolveonopenblockers
- password_complexity
- rememberlogin
- requirelogin
- search_allow_no_criteria
- urlbase
- use_see_also
- useclassification
- usemenuforusers
- useqacontact
- usestatuswhiteboard
- usetargetmilestone
+ allowemailchange
+ attachment_base
+ commentonchange_resolution
+ commentonduplicate
+ cookiepath
+ defaultopsys
+ defaultplatform
+ defaultpriority
+ defaultseverity
+ duplicate_or_move_bug_status
+ emailregexpdesc
+ emailsuffix
+ letsubmitterchoosemilestone
+ letsubmitterchoosepriority
+ mailfrom
+ maintainer
+ maxattachmentsize
+ maxlocalattachment
+ musthavemilestoneonaccept
+ noresolveonopenblockers
+ password_complexity
+ rememberlogin
+ requirelogin
+ search_allow_no_criteria
+ urlbase
+ use_see_also
+ useclassification
+ usemenuforusers
+ useqacontact
+ usestatuswhiteboard
+ usetargetmilestone
);
sub version {
- my $self = shift;
- return { version => $self->type('string', BUGZILLA_VERSION) };
+ my $self = shift;
+ return {version => $self->type('string', BUGZILLA_VERSION)};
}
sub extensions {
- my $self = shift;
-
- my %retval;
- foreach my $extension (@{ Bugzilla->extensions }) {
- my $version = $extension->VERSION || 0;
- my $name = $extension->NAME;
- $retval{$name}->{version} = $self->type('string', $version);
- }
- return { extensions => \%retval };
+ my $self = shift;
+
+ my %retval;
+ foreach my $extension (@{Bugzilla->extensions}) {
+ my $version = $extension->VERSION || 0;
+ my $name = $extension->NAME;
+ $retval{$name}->{version} = $self->type('string', $version);
+ }
+ return {extensions => \%retval};
}
sub timezone {
- my $self = shift;
- # All Webservices return times in UTC; Use UTC here for backwards compat.
- return { timezone => $self->type('string', "+0000") };
+ my $self = shift;
+
+ # All Webservices return times in UTC; Use UTC here for backwards compat.
+ return {timezone => $self->type('string', "+0000")};
}
sub time {
- my ($self) = @_;
- # All Webservices return times in UTC; Use UTC here for backwards compat.
- # Hardcode values where appropriate
- my $dbh = Bugzilla->dbh;
-
- my $db_time = $dbh->selectrow_array('SELECT LOCALTIMESTAMP(0)');
- $db_time = datetime_from($db_time, 'UTC');
- my $now_utc = DateTime->now();
-
- return {
- db_time => $self->type('dateTime', $db_time),
- web_time => $self->type('dateTime', $now_utc),
- web_time_utc => $self->type('dateTime', $now_utc),
- tz_name => $self->type('string', 'UTC'),
- tz_offset => $self->type('string', '+0000'),
- tz_short_name => $self->type('string', 'UTC'),
- };
+ my ($self) = @_;
+
+ # All Webservices return times in UTC; Use UTC here for backwards compat.
+ # Hardcode values where appropriate
+ my $dbh = Bugzilla->dbh;
+
+ my $db_time = $dbh->selectrow_array('SELECT LOCALTIMESTAMP(0)');
+ $db_time = datetime_from($db_time, 'UTC');
+ my $now_utc = DateTime->now();
+
+ return {
+ db_time => $self->type('dateTime', $db_time),
+ web_time => $self->type('dateTime', $now_utc),
+ web_time_utc => $self->type('dateTime', $now_utc),
+ tz_name => $self->type('string', 'UTC'),
+ tz_offset => $self->type('string', '+0000'),
+ tz_short_name => $self->type('string', 'UTC'),
+ };
}
sub last_audit_time {
- my ($self, $params) = validate(@_, 'class');
- my $dbh = Bugzilla->dbh;
-
- my $sql_statement = "SELECT MAX(at_time) FROM audit_log";
- my $class_values = $params->{class};
- my @class_values_quoted;
- foreach my $class_value (@$class_values) {
- push (@class_values_quoted, $dbh->quote($class_value))
- if $class_value =~ /^Bugzilla(::[a-zA-Z0-9_]+)*$/;
- }
-
- if (@class_values_quoted) {
- $sql_statement .= " WHERE " . $dbh->sql_in('class', \@class_values_quoted);
- }
-
- my $last_audit_time = $dbh->selectrow_array("$sql_statement");
-
- # All Webservices return times in UTC; Use UTC here for backwards compat.
- # Hardcode values where appropriate
- $last_audit_time = datetime_from($last_audit_time, 'UTC');
-
- return {
- last_audit_time => $self->type('dateTime', $last_audit_time)
- };
+ my ($self, $params) = validate(@_, 'class');
+ my $dbh = Bugzilla->dbh;
+
+ my $sql_statement = "SELECT MAX(at_time) FROM audit_log";
+ my $class_values = $params->{class};
+ my @class_values_quoted;
+ foreach my $class_value (@$class_values) {
+ push(@class_values_quoted, $dbh->quote($class_value))
+ if $class_value =~ /^Bugzilla(::[a-zA-Z0-9_]+)*$/;
+ }
+
+ if (@class_values_quoted) {
+ $sql_statement .= " WHERE " . $dbh->sql_in('class', \@class_values_quoted);
+ }
+
+ my $last_audit_time = $dbh->selectrow_array("$sql_statement");
+
+ # All Webservices return times in UTC; Use UTC here for backwards compat.
+ # Hardcode values where appropriate
+ $last_audit_time = datetime_from($last_audit_time, 'UTC');
+
+ return {last_audit_time => $self->type('dateTime', $last_audit_time)};
}
sub parameters {
- my ($self, $args) = @_;
- my $user = Bugzilla->login(LOGIN_OPTIONAL);
- my $params = Bugzilla->params;
- $args ||= {};
-
- my @params_list = $user->in_group('tweakparams')
- ? keys(%$params)
- : $user->id ? PARAMETERS_LOGGED_IN : PARAMETERS_LOGGED_OUT;
-
- my %parameters;
- foreach my $param (@params_list) {
- next unless filter_wants($args, $param);
- $parameters{$param} = $self->type('string', $params->{$param});
- }
-
- return { parameters => \%parameters };
+ my ($self, $args) = @_;
+ my $user = Bugzilla->login(LOGIN_OPTIONAL);
+ my $params = Bugzilla->params;
+ $args ||= {};
+
+ my @params_list
+ = $user->in_group('tweakparams') ? keys(%$params)
+ : $user->id ? PARAMETERS_LOGGED_IN
+ : PARAMETERS_LOGGED_OUT;
+
+ my %parameters;
+ foreach my $param (@params_list) {
+ next unless filter_wants($args, $param);
+ $parameters{$param} = $self->type('string', $params->{$param});
+ }
+
+ return {parameters => \%parameters};
}
1;