summaryrefslogtreecommitdiffstats
path: root/extensions/BMO/lib/Data.pm
blob: c5f96bdf3b1cef30149239b9a7dd821f5d198544 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
# -*- 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 BMO Bugzilla Extension.
#
# The Initial Developer of the Original Code is the Mozilla Foundation.
# Portions created by the Initial Developer are Copyright (C) 2010 the
# Initial Developer. All Rights Reserved.
#
# Contributor(s):
#   Gervase Markham <gerv@gerv.net>
#   Reed Loden <reed@reedloden.com>

package Bugzilla::Extension::BMO::Data;
use strict;

use base qw(Exporter);
use Tie::IxHash;

our @EXPORT_OK = qw($cf_visible_in_products
                    $cf_flags $cf_project_flags
                    $cf_disabled_flags
                    %group_change_notification
                    $blocking_trusted_setters
                    $blocking_trusted_requesters
                    $status_trusted_wanters
                    $status_trusted_setters
                    $other_setters
                    %always_fileable_group
                    %group_auto_cc
                    %product_sec_groups);

# Which custom fields are visible in which products and components.
#
# By default, custom fields are visible in all products. However, if the name
# of the field matches any of these regexps, it is only visible if the 
# product (and component if necessary) is a member of the attached hash. []
# for component means "all".
#
# IxHash keeps them in insertion order, and so we get regexp priorities right.
our $cf_visible_in_products;
tie(%$cf_visible_in_products, "Tie::IxHash", 
    qw/^cf_blocking_kilimanjaro|cf_blocking_basecamp|cf_blocking_b2g/ => {
        "Boot2Gecko"          => [],
        "Core"                => [],
        "Fennec"              => [],
        "Firefox for Android" => [],
        "Firefox"             => [],
        "Firefox for Metro"   => [],
        "Marketplace"         => [],
        "mozilla.org"         => [],
        "Mozilla Services"    => [],
        "NSPR"                => [],
        "NSS"                 => [],
        "Socorro"             => [],
        "Testing"             => [],
        "Thunderbird"         => [],
        "Toolkit"             => [],
        "Tracking"            => [],
        "Web Apps"            => [],
    }, 
    qr/^cf_blocking_fennec/ => {
        "addons.mozilla.org"    => [],
        "AUS"                   => [],
        "Core"                  => [],
        "Fennec"                => [],
        "Firefox for Android"   => [],
        "Marketing"             => ["General"],
        "mozilla.org"           => ["Release Engineering", qr/^Release Engineering: /],
        "Mozilla Localizations" => [],
        "Mozilla Services"      => [],
        "NSPR"                  => [],
        "support.mozilla.org"   => [],
        "Toolkit"               => [],
        "Tech Evangelism"       => [],
        "Testing"               => ["General"],
    },
    qr/^cf_tracking_thunderbird|cf_blocking_thunderbird|cf_status_thunderbird/ => {
        "support.mozillamessaging.com"  => [],
        "Thunderbird"                   => [],
        "MailNews Core"                 => [],
        "Mozilla Messaging"             => [],
        "Websites"                      => ["www.mozillamessaging.com"],
    },
    qr/^(cf_(blocking|tracking)_seamonkey|cf_status_seamonkey)/ => {
        "Composer"              => [],
        "MailNews Core"         => [],
        "Mozilla Localizations" => [],
        "Other Applications"    => [],
        "SeaMonkey"             => [],
    },
    qr/^cf_blocking_|cf_tracking_|cf_status/ => {
        "Add-on SDK"            => [],
        "addons.mozilla.org"    => [],
        "AUS"                   => [],
        "Boot2Gecko"            => [],
        "Core Graveyard"        => [],
        "Core"                  => [],
        "Directory"             => [],
        "Fennec"                => [],
        "Firefox for Android"   => [],
        "Firefox"               => [],
        "Firefox for Metro"     => [],
        "MailNews Core"         => [],
        "mozilla.org"           => ["Release Engineering", qr/^Release Engineering: /],
        "Mozilla QA"            => ["Mozmill Tests"],
        "Mozilla Localizations" => [],
        "Mozilla Services"      => [],
        "NSPR"                  => [],
        "NSS"                   => [],
        "Other Applications"    => [],
        "SeaMonkey"             => [],
        "Socorro"               => [], 
        "support.mozilla.org"   => [],
        "Tech Evangelism"       => [],
        "Testing"               => [],
        "Toolkit"               => [],
        "Websites"              => ["getpersonas.com"],
        "Webtools"              => [],
        "Plugins"               => [],
    },
    qr/^cf_colo_site$/ => {
        "mozilla.org"           => [
            "Server Operations",
            "Server Operations: DCOps",
            "Server Operations: Projects",
            "Server Operations: RelEng",
            "Server Operations: Security",
        ],
    },
    qw/^cf_office$/ => {
        "mozilla.org"           => ["Server Operations: Desktop Issues"],
    },
    qr/^cf_crash_signature$/ => {
        "addons.mozilla.org"    => [],
        "Add-on SDK"            => [],
        "Boot2Gecko"            => [],
        "Calendar"              => [],
        "Camino"                => [],
        "Composer"              => [],
        "Fennec"                => [],
        "Firefox for Android"   => [],
        "Firefox"               => [],
        "Firefox for Metro"     => [],
        "Mozilla Localizations" => [],
        "Mozilla Services"      => [],
        "Other Applications"    => [],
        "Penelope"              => [],
        "SeaMonkey"             => [],
        "Thunderbird"           => [],
        "Core"                  => [],
        "Directory"             => [],
        "JSS"                   => [],
        "MailNews Core"         => [],
        "NSPR"                  => [],
        "NSS"                   => [],
        "Plugins"               => [],
        "Rhino"                 => [],
        "Tamarin"               => [],
        "Testing"               => [],
        "Toolkit"               => [],
        "Mozilla Labs"          => [],
        "mozilla.org"           => [],
        "Tech Evangelism"       => [],
    },
    qw/^cf_due_date$/ => {
        "Mozilla Reps" => [],
        "mozilla.org"  => ["Security Assurance: Review Request"],
    },
    qw/^cf_locale$/ => {
        "www.mozilla.org"       => [],
    },
);

# Which custom fields are acting as flags (ie. custom flags)
our $cf_flags = [
    qr/^cf_(?:blocking|tracking|status)_/,
];

our $cf_project_flags = [
    'cf_blocking_kilimanjaro',
    'cf_blocking_b2g',
    'cf_blocking_basecamp',
];

# List of disabled fields.
# Temp kludge until custom fields can be disabled correctly upstream.
# Disabled fields are hidden unless they have a value set
our $cf_disabled_flags = [
    'cf_blocking_20',
    'cf_status_20',
    'cf_tracking_firefox5',
    'cf_status_firefox5',
    'cf_blocking_thunderbird32',
    'cf_status_thunderbird32',
    'cf_blocking_thunderbird30',
    'cf_status_thunderbird30',
    'cf_blocking_seamonkey21',
    'cf_status_seamonkey21',
    'cf_tracking_seamonkey22',
    'cf_status_seamonkey22',
    'cf_tracking_firefox6',
    'cf_status_firefox6',
    'cf_tracking_thunderbird6',
    'cf_status_thunderbird6',
    'cf_tracking_seamonkey23',
    'cf_status_seamonkey23',
    'cf_tracking_firefox7',
    'cf_status_firefox7',
    'cf_tracking_thunderbird7',
    'cf_status_thunderbird7',
    'cf_tracking_seamonkey24',
    'cf_status_seamonkey24',
    'cf_tracking_firefox8',
    'cf_status_firefox8',
    'cf_tracking_thunderbird8',
    'cf_status_thunderbird8',
    'cf_tracking_seamonkey25',
    'cf_status_seamonkey25',
    'cf_blocking_191',
    'cf_status_191',
    'cf_blocking_thunderbird33',
    'cf_status_thunderbird33',
    'cf_tracking_firefox9',
    'cf_status_firefox9',
    'cf_tracking_thunderbird9',
    'cf_status_thunderbird9',
    'cf_tracking_seamonkey26',
    'cf_status_seamonkey26',
    'cf_tracking_firefox10',
    'cf_status_firefox10',
    'cf_tracking_thunderbird10',
    'cf_status_thunderbird10',
    'cf_tracking_seamonkey27',
    'cf_status_seamonkey27',
    'cf_tracking_firefox11',
    'cf_status_firefox11',
    'cf_tracking_thunderbird11',
    'cf_status_thunderbird11',
    'cf_tracking_seamonkey28',
    'cf_status_seamonkey28',
    'cf_tracking_firefox12',
    'cf_status_firefox12',
    'cf_tracking_thunderbird12',
    'cf_status_thunderbird12',
    'cf_tracking_seamonkey29',
    'cf_status_seamonkey29',
    'cf_blocking_192',
    'cf_status_192',
    'cf_blocking_fennec10',
    'cf_tracking_firefox13',
    'cf_status_firefox13',
    'cf_tracking_thunderbird13',
    'cf_status_thunderbird13',
    'cf_tracking_seamonkey210',
    'cf_status_seamonkey210',
    'cf_tracking_firefox14',
    'cf_status_firefox14',
    'cf_tracking_thunderbird14',
    'cf_status_thunderbird14',
    'cf_tracking_seamonkey211',
    'cf_status_seamonkey211',
    'cf_tracking_firefox15',
    'cf_status_firefox15',
    'cf_tracking_thunderbird15',
    'cf_status_thunderbird15',
    'cf_tracking_seamonkey212',
    'cf_status_seamonkey212',
    'cf_tracking_firefox16',
    'cf_status_firefox16',
    'cf_tracking_thunderbird16',
    'cf_status_thunderbird16',
    'cf_tracking_seamonkey213',
    'cf_status_seamonkey213',
    'cf_tracking_firefox17',
    'cf_status_firefox17',
    'cf_tracking_thunderbird17',
    'cf_status_thunderbird17',
    'cf_tracking_seamonkey214',
    'cf_status_seamonkey214',
];

# Who to CC on particular bugmails when certain groups are added or removed.
our %group_change_notification = (
  'addons-security'           => ['amo-editors@mozilla.org'], 
  'bugzilla-security'         => ['security@bugzilla.org'],
  'client-services-security'  => ['amo-admins@mozilla.org', 'web-security@mozilla.org'],
  'core-security'             => ['security@mozilla.org'],
  'mozilla-services-security' => ['web-security@mozilla.org'],
  'tamarin-security'          => ['tamarinsecurity@adobe.com'],
  'websites-security'         => ['web-security@mozilla.org'],
  'webtools-security'         => ['web-security@mozilla.org'],
);

# Only users in certain groups can change certain custom fields in 
# certain ways. 
#
# Who can set cf_blocking_* or cf_tracking_* to +/-
our $blocking_trusted_setters = {
    'cf_blocking_fennec'          => 'fennec-drivers',
    'cf_blocking_20'              => 'mozilla-next-drivers',
    qr/^cf_tracking_firefox/      => 'mozilla-next-drivers',
    qr/^cf_blocking_thunderbird/  => 'thunderbird-drivers',
    qr/^cf_tracking_thunderbird/  => 'thunderbird-drivers',
    qr/^cf_tracking_seamonkey/    => 'seamonkey-council',
    qr/^cf_blocking_seamonkey/    => 'seamonkey-council',
    qr/^cf_blocking_kilimanjaro/  => 'kilimanjaro-drivers',
    qr/^cf_blocking_basecamp/     => 'kilimanjaro-drivers',
    qr/^cf_tracking_b2g/          => 'kilimanjaro-drivers',
    qr/^cf_blocking_b2g/          => 'kilimanjaro-drivers',
    '_default'                    => 'mozilla-stable-branch-drivers',
};

# Who can request cf_blocking_* or cf_tracking_*
our $blocking_trusted_requesters = {
    qr/^cf_blocking_thunderbird/  => 'thunderbird-trusted-requesters',
    '_default'                    => 'everyone',
};

# Who can set cf_status_* to "wanted"?
our $status_trusted_wanters = {
    'cf_status_20'                => 'mozilla-next-drivers',
    qr/^cf_status_thunderbird/    => 'thunderbird-drivers',
    qr/^cf_status_seamonkey/      => 'seamonkey-council',
    '_default'                    => 'mozilla-stable-branch-drivers',
};

# Who can set cf_status_* to values other than "wanted"?
our $status_trusted_setters = {
    qr/^cf_status_thunderbird/    => 'editbugs',
    '_default'                    => 'canconfirm',
};

# Who can set other custom flags (use full field names only, not regex's)
our $other_setters = {
    'cf_colo_site'  => ['infra', 'build'],
};

# Groups in which you can always file a bug, whoever you are.
our %always_fileable_group = (
    'addons-security'                   => 1,
    'bugzilla-security'                 => 1,
    'client-services-security'          => 1,
    'consulting'                        => 1,
    'core-security'                     => 1,
    'finance'                           => 1,
    'infra'                             => 1,
    'infrasec'                          => 1,
    'l20n-security'                     => 1,
    'marketing-private'                 => 1,
    'mozilla-confidential'              => 1,
    'mozilla-corporation-confidential'  => 1,
    'mozilla-foundation-confidential'   => 1,
    'mozilla-messaging-confidential'    => 1,
    'partner-confidential'              => 1,
    'payments-confidential'             => 1,
    'tamarin-security'                  => 1,
    'websites-security'                 => 1,
    'webtools-security'                 => 1,
    'winqual-data'                      => 1,
);

# Mapping of products to their security bits
our %product_sec_groups = (
    "addons.mozilla.org"           => 'client-services-security',
    "AUS"                          => 'client-services-security',
    "Bugzilla"                     => 'bugzilla-security',
    "bugzilla.mozilla.org"         => 'bugzilla-security',
    "Community Tools"              => 'websites-security',
    "Finance"                      => 'finance',
    "Input"                        => 'websites-security',
    "L20n"                         => 'l20n-security',
    "Legal"                        => 'legal',
    "Marketing"                    => 'marketing-private',
    "Marketplace"                  => 'client-services-security',
    "Mozilla Corporation"          => 'mozilla-corporation-confidential',
    "Mozilla Developer Network"    => 'websites-security',
    "Mozilla Grants"               => 'grants',
    "Mozilla Messaging"            => 'mozilla-messaging-confidential',
    "Mozilla Metrics"              => 'metrics-private',
    "mozilla.org"                  => 'mozilla-confidential',
    "Mozilla PR"                   => 'pr-private',
    "Mozilla QA"                   => 'mozilla-corporation-confidential',
    "Mozilla Reps"                 => 'mozilla-reps',
    "Mozilla Services"             => 'mozilla-services-security',
    "mozillaignite"                => 'websites-security',
    "Popcorn"                      => 'websites-security',
    "Privacy"                      => 'privacy',
    "quality.mozilla.org"          => 'websites-security',
    "Skywriter"                    => 'websites-security',
    "Socorro"                      => 'client-services-security',
    "support.mozilla.org"          => 'websites-security',
    "support.mozillamessaging.com" => 'websites-security',
    "Talkback"                     => 'talkback-private',
    "Tamarin"                      => 'tamarin-security',
    "Testopia"                     => 'bugzilla-security',
    "Web Apps"                     => 'client-services-security',
    "webmaker.org"                 => 'websites-security',
    "Thimble"                      => 'websites-security',
    "Websites"                     => 'websites-security',
    "Websites Graveyard"           => 'websites-security',
    "Webtools"                     => 'webtools-security',
    "www.mozilla.org"              => 'websites-security',
    "_default"                     => 'core-security'
);

# Automatically CC users to bugs filed into configured groups and products
our %group_auto_cc = (
    'partner-confidential' => {
        '_default' => ['mbest@mozilla.com'],
    },
);

# Default security groups for products should always been fileable
map { $always_fileable_group{$_} = 1 } values %product_sec_groups;

1;