summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorbugreport%peshkin.net <>2004-06-16 14:04:47 +0200
committerbugreport%peshkin.net <>2004-06-16 14:04:47 +0200
commitb34fac97b1ef5a46fd3c3a63cdf56b0626aa74b3 (patch)
treee06e31a87d53f548ec31a2dbabba55e1bc646552 /Bugzilla
parent769f4071b43017decf24293fb15fdea5245bf712 (diff)
downloadbugzilla-b34fac97b1ef5a46fd3c3a63cdf56b0626aa74b3.tar.gz
bugzilla-b34fac97b1ef5a46fd3c3a63cdf56b0626aa74b3.tar.xz
Bug 240325: Keep regexp-based groups up-to-date
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Constants.pm8
-rw-r--r--Bugzilla/User.pm18
2 files changed, 18 insertions, 8 deletions
diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm
index 1ccde6b99..e3cdf539d 100644
--- a/Bugzilla/Constants.pm
+++ b/Bugzilla/Constants.pm
@@ -50,6 +50,10 @@ use base qw(Exporter);
LOGOUT_ALL
LOGOUT_CURRENT
LOGOUT_KEEP_CURRENT
+
+ GRANT_DIRECT
+ GRANT_DERIVED
+ GRANT_REGEXP
);
@Bugzilla::Constants::EXPORT_OK = qw(contenttypes);
@@ -114,4 +118,8 @@ use constant contenttypes =>
"ics" => "text/calendar" ,
};
+use constant GRANT_DIRECT => 0;
+use constant GRANT_DERIVED => 1;
+use constant GRANT_REGEXP => 2;
+
1;
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index c9535d7bf..b3d953945 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -35,6 +35,7 @@ package Bugzilla::User;
use Bugzilla::Config;
use Bugzilla::Error;
use Bugzilla::Util;
+use Bugzilla::Constants;
################################################################################
# Functions
@@ -246,9 +247,10 @@ sub derive_groups {
# first remove any old derived stuff for this user
$dbh->do(q{DELETE FROM user_group_map
WHERE user_id = ?
- AND isderived = 1},
+ AND grant_type != ?},
undef,
- $id);
+ $id,
+ GRANT_DIRECT);
my %groupidsadded = ();
# add derived records for any matching regexps
@@ -260,10 +262,10 @@ sub derive_groups {
while (my $row = $sth->fetch) {
if ($self->{login} =~ m/$row->[1]/i) {
$group_insert ||= $dbh->prepare(q{INSERT INTO user_group_map
- (user_id, group_id, isbless, isderived)
- VALUES (?, ?, 0, 1)});
+ (user_id, group_id, isbless, grant_type)
+ VALUES (?, ?, 0, ?)});
$groupidsadded{$row->[0]} = 1;
- $group_insert->execute($id, $row->[0]);
+ $group_insert->execute($id, $row->[0], GRANT_REGEXP);
}
}
@@ -294,9 +296,9 @@ sub derive_groups {
if (!$groupidsadded{$groupid}) {
$groupidsadded{$groupid} = 1;
$group_insert ||= $dbh->prepare(q{INSERT INTO user_group_map
- (user_id, group_id, isbless, isderived)
- VALUES (?, ?, 0, 1)});
- $group_insert->execute($id, $groupid);
+ (user_id, group_id, isbless, grant_type)
+ VALUES (?, ?, 0, ?)});
+ $group_insert->execute($id, $groupid, GRANT_DERIVED);
}
}
}