1
# -*- Mode: perl; indent-tabs-mode: nil -*-
3
# The contents of this file are subject to the Mozilla Public
4
# License Version 1.1 (the "License"); you may not use this file
5
# except in compliance with the License. You may obtain a copy of
6
# the License at http://www.mozilla.org/MPL/
8
# Software distributed under the License is distributed on an "AS
9
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
10
# implied. See the License for the specific language governing
11
# rights and limitations under the License.
13
# The Original Code is the Bugzilla Bug Tracking System.
15
# Contributor(s): Marc Schumann <wurblzap@gmail.com>
16
# Max Kanat-Alexander <mkanat@bugzilla.org>
18
package Bugzilla::WebService::Constants;
21
use base qw(Exporter);
23
@Bugzilla::WebService::Constants::EXPORT = qw(
26
ERROR_UNKNOWN_TRANSIENT
34
# This maps the error names in global/*-error.html.tmpl to numbers.
35
# Generally, transient errors should have a number above 0, and
36
# fatal errors should have a number below 0.
38
# This hash should generally contain any error that could be thrown
39
# by the WebService interface. If it's extremely unlikely that the
40
# error could be thrown (like some CodeErrors), it doesn't have to
43
# "Transient" means "If you resubmit that request with different data,
46
# "Fatal" means, "There's something wrong with Bugzilla, probably
47
# something an administrator would have to fix."
49
# NOTE: Numbers must never be recycled. If you remove a number, leave a
50
# comment that it was retired. Also, if an error changes its name, you'll
51
# have to fix it here.
52
use constant WS_ERROR_CODE => {
53
# Bug errors usually occupy the 100-200 range.
54
invalid_bug_id_or_alias => 100,
55
invalid_bug_id_non_existent => 101,
56
bug_access_denied => 102,
57
bug_access_query => 102,
58
invalid_field_name => 108,
59
# These all mean "invalid alias"
60
alias_not_defined => 103,
61
alias_too_long => 103,
63
alias_is_numeric => 103,
64
alias_has_comma_or_space => 103,
65
# Misc. bug field errors
67
freetext_too_long => 104,
69
require_component => 105,
70
component_name_too_long => 105,
71
component_not_valid => 105,
74
entry_access_denied => 106,
75
product_access_denied => 106,
76
product_disabled => 106,
78
require_summary => 107,
80
# Authentication errors are usually 300-400.
81
invalid_username_or_password => 300,
82
account_disabled => 301,
83
auth_invalid_email => 302,
84
extern_id_conflict => -303,
86
# User errors are 500-600.
87
account_exists => 500,
88
illegal_email_address => 501,
89
account_creation_disabled => 501,
90
password_too_short => 502,
91
password_too_long => 503,
92
invalid_username => 504,
93
# This is from strict_isolation, but it also basically means
95
invalid_user_group => 504,
98
# These are the fallback defaults for errors not in ERROR_CODE.
99
use constant ERROR_UNKNOWN_FATAL => -32000;
100
use constant ERROR_UNKNOWN_TRANSIENT => 32000;
102
use constant ERROR_AUTH_NODATA => 410;
103
use constant ERROR_UNIMPLEMENTED => 910;
104
use constant ERROR_GENERAL => 999;
106
# For some methods, we shouldn't call Bugzilla->login before we call them.
107
# This is a hash--package names pointing to an arrayref of method names.
108
use constant LOGIN_EXEMPT => {
109
# Callers may have to know the Bugzilla version before logging in,
110
# even on a requirelogin installation.
111
Bugzilla => ['version', 'timezone'],
112
User => ['offer_account_by_email', 'login'],