From b34fac97b1ef5a46fd3c3a63cdf56b0626aa74b3 Mon Sep 17 00:00:00 2001 From: "bugreport%peshkin.net" <> Date: Wed, 16 Jun 2004 12:04:47 +0000 Subject: Bug 240325: Keep regexp-based groups up-to-date --- editusers.cgi | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) (limited to 'editusers.cgi') diff --git a/editusers.cgi b/editusers.cgi index f83a64984..f7824e435 100755 --- a/editusers.cgi +++ b/editusers.cgi @@ -138,8 +138,9 @@ sub EmitFormElements ($$$$) if($user ne "") { print "Group Access:"; SendSQL("SELECT groups.id, groups.name, groups.description, " . - "COUNT(user_id), " . - "MAX(isderived) " . + "MAX(grant_type = " . GRANT_DIRECT . "), " . + "MAX(grant_type = " . GRANT_DERIVED . "), " . + "MAX(grant_type = " . GRANT_REGEXP . ") " . "FROM groups " . "LEFT JOIN user_group_map " . "ON user_group_map.group_id = groups.id " . @@ -153,10 +154,8 @@ sub EmitFormElements ($$$$) } print "\n"; while (MoreSQLData()) { - my ($groupid, $name, $description, $member, $isderived) = FetchSQLData(); + my ($groupid, $name, $description, $checked, $isderived, $isregexp) = FetchSQLData(); next if (!$editall && !UserCanBlessGroup($name)); - $isderived = $isderived || 0; - my $checked = $member - $isderived; PushGlobalSQLState(); SendSQL("SELECT user_id " . "FROM user_group_map " . @@ -174,7 +173,7 @@ sub EmitFormElements ($$$$) my $derivedbless = FetchOneColumn(); PopGlobalSQLState(); print "\n"; print "\n"; print "\n"; @@ -189,8 +188,10 @@ sub EmitFormElements ($$$$) $checked = ($checked) ? "CHECKED" : ""; print "\n"; } @@ -704,13 +705,13 @@ if ($action eq 'edit') { value_quote($disabledtext) . "\">\n"; print "\n"; print "\n"; - print "
User is a member of any groups shown with grey bars and - marked with brackets surrounding the membership checkbox as a - result of a regular expression match - or membership in another group. - User can bless any group - marked with brackets surrounding the bless checkbox as a - result of membership in another group. + print "
User is a member of any groups shown with a check or grey bar. + A grey bar indicates indirect membership, either derived from other + groups (marked with square brackets) or via regular expression + (marked with '*').

+ Square brackets around the bless checkbox indicate the ability + to bless users (grant them membership in the group) as a result + of membership in another group.
"; print ""; @@ -761,11 +762,11 @@ if ($action eq 'update') { WHERE user_id = $thisuserid AND group_id = $groupid AND isbless = 0 - AND isderived = 0"); + AND grant_type = " . GRANT_DIRECT); if ($::FORM{"group_$groupid"}) { SendSQL("INSERT INTO user_group_map - (user_id, group_id, isbless, isderived) - VALUES ($thisuserid, $groupid, 0, 0)"); + (user_id, group_id, isbless, grant_type) + VALUES ($thisuserid, $groupid, 0," . GRANT_DIRECT . ")"); print "Added user to group $name
\n"; push(@grpadd, $name); } else { @@ -781,11 +782,11 @@ if ($action eq 'update') { WHERE user_id = $thisuserid AND group_id = $groupid AND isbless = 1 - AND isderived = 0"); + AND grant_type = " . GRANT_DIRECT); if ($::FORM{"bless_$groupid"}) { SendSQL("INSERT INTO user_group_map - (user_id, group_id, isbless, isderived) - VALUES ($thisuserid, $groupid, 1, 0)"); + (user_id, group_id, isbless, grant_type) + VALUES ($thisuserid, $groupid, 1," . GRANT_DIRECT . ")"); print "Granted user permission to bless group $name
\n"; } else { print "Revoked user's permission to bless group $name
\n"; -- cgit v1.2.3-24-g4f1b

User is a member of these groups
"; print '[' if ($isderived); + print '*' if ($isregexp); print ""; print ']' if ($isderived); + print '*' if ($isregexp); print ""; print ucfirst($name) . ": $description