summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2018-03-10 17:59:51 +0100
committerDylan William Hardison <dylan@hardison.net>2018-03-10 18:08:36 +0100
commit8ba3f387cd09504cd0ca357b3557d705d044633b (patch)
treef99c82609dc493ba3c288a81a5ba152ae85d947e /Bugzilla
parent2056caa180f907c6e5727954547dfd928cf6a360 (diff)
downloadbugzilla-8ba3f387cd09504cd0ca357b3557d705d044633b.tar.gz
bugzilla-8ba3f387cd09504cd0ca357b3557d705d044633b.tar.xz
initial changes, no templates
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Config/GroupSecurity.pm26
-rw-r--r--Bugzilla/DB/Schema.pm12
-rw-r--r--Bugzilla/Product.pm60
3 files changed, 98 insertions, 0 deletions
diff --git a/Bugzilla/Config/GroupSecurity.pm b/Bugzilla/Config/GroupSecurity.pm
index 68c852fe6..c1d2faac1 100644
--- a/Bugzilla/Config/GroupSecurity.pm
+++ b/Bugzilla/Config/GroupSecurity.pm
@@ -84,6 +84,32 @@ sub get_param_list {
name => 'strict_isolation',
type => 'b',
default => 0
+ },
+ {
+ name => 'always_filleable_groups',
+ type => 'l',
+ default => join(", ", qw(
+ addons-security
+ bugzilla-security
+ client-services-security
+ consulting
+ core-security
+ finance
+ infra
+ infrasec
+ l20n-security
+ marketing-private
+ mozilla-confidential
+ mozilla-employee-confidential
+ mozilla-foundation-confidential
+ mozilla-engagement
+ mozilla-messaging-confidential
+ partner-confidential
+ payments-confidential
+ tamarin-security
+ websites-security
+ webtools-security
+ )),
}
);
return @param_list;
diff --git a/Bugzilla/DB/Schema.pm b/Bugzilla/DB/Schema.pm
index 3307464db..41afaeacf 100644
--- a/Bugzilla/DB/Schema.pm
+++ b/Bugzilla/DB/Schema.pm
@@ -1410,6 +1410,18 @@ use constant ABSTRACT_SCHEMA => {
NOTNULL => 1, DEFAULT => "'---'"},
allows_unconfirmed => {TYPE => 'BOOLEAN', NOTNULL => 1,
DEFAULT => 'TRUE'},
+ default_op_sys_id => {TYPE => 'INT2',
+ REFERENCES => {TABLE => 'op_sys',
+ COLUMN => 'id',
+ DELETE => 'SET NULL'}},
+ default_platform_id => {TYPE => 'INT2',
+ REFERENCES => {TABLE => 'rep_platform',
+ COLUMN => 'id',
+ DELETE => 'SET NULL'}},
+ security_group_id => {TYPE => 'INT3',
+ REFERENCES => {TABLE => 'groups',
+ COLUMN => 'id',
+ DELETE => 'SET NULL'}},
],
INDEXES => [
products_name_idx => {FIELDS => ['name'],
diff --git a/Bugzilla/Product.pm b/Bugzilla/Product.pm
index 3ac1692f0..9cf4bf397 100644
--- a/Bugzilla/Product.pm
+++ b/Bugzilla/Product.pm
@@ -47,6 +47,9 @@ use constant DB_COLUMNS => qw(
isactive
defaultmilestone
allows_unconfirmed
+ default_platform_id
+ default_op_sys_id
+ security_group_id
);
use constant UPDATE_COLUMNS => qw(
@@ -55,6 +58,9 @@ use constant UPDATE_COLUMNS => qw(
defaultmilestone
isactive
allows_unconfirmed
+ default_platform_id
+ default_op_sys_id
+ security_group_id
);
use constant VALIDATORS => {
@@ -837,6 +843,60 @@ sub is_active { return $_[0]->{'isactive'}; }
sub default_milestone { return $_[0]->{'defaultmilestone'}; }
sub classification_id { return $_[0]->{'classification_id'}; }
+sub default_security_group {
+ my ($self) = @_;
+ return $self->default_security_group_obj->name;
+}
+
+sub default_security_group_obj {
+ my ($self) = @_;
+ my $group_id = $self->{security_group_id};
+ if (!$group_id) {
+ return Bugzilla::Group->new({ name => Bugzilla->params->{insidergroup}, cache => 1 });
+ }
+ return Bugzilla::Group->new({ id => $group_id, cache => 1 });
+}
+
+sub default_platform_id { shift->{default_platform_id} }
+sub default_op_sys_id { shift->{default_op_sys_id} }
+
+# you can always file bugs into a product's default security group, as well as
+# into any of the groups in @always_fileable_groups
+sub group_always_settable {
+ my ( $self, $group ) = @_;
+ my @always_fileable_groups = split(/\s*,\s*/, Bugzilla->params->{always_fileable_groups});
+ return $group->name eq $self->default_security_group
+ || ( ( any { $_ eq $group->name } @always_fileable_groups ) ? 1 : 0 );
+}
+
+
+sub default_platform {
+ my ($self) = @_;
+ if (!exists $self->{default_platform}) {
+ $self->{default_platform} = $self->default_platform_id
+ ? Bugzilla::Field::Choice
+ ->type('rep_platform')
+ ->new($self->{default_platform_id})
+ ->name
+ : undef;
+ }
+ return $self->{default_platform};
+}
+
+sub default_op_sys {
+ my ($self) = @_;
+ if (!exists $self->{default_op_sys}) {
+ $self->{default_op_sys} = $self->default_op_sys_id
+ ? Bugzilla::Field::Choice
+ ->type('op_sys')
+ ->new($self->{default_op_sys_id})
+ ->name
+ : undef;
+ }
+ return $self->{default_op_sys};
+}
+
+
###############################
#### Subroutines ######
###############################