aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwurblzap%gmail.com <>2006-07-14 03:07:57 +0000
committerwurblzap%gmail.com <>2006-07-14 03:07:57 +0000
commitf0c7611262b3948e72e8a18a036569a78f3b51f2 (patch)
tree54b0e146d4f8fd3c466002728261c895d7709034 /editusers.cgi
parentBug 344298: importxml.pl performance problem - Patch by Vance Baarda <vrb@nov... (diff)
downloadbugzilla-f0c7611262b3948e72e8a18a036569a78f3b51f2.tar.gz
bugzilla-f0c7611262b3948e72e8a18a036569a78f3b51f2.tar.bz2
bugzilla-f0c7611262b3948e72e8a18a036569a78f3b51f2.zip
Bug 69000: Permit a stored query to be marked "shared" and accessible by other users.
Patch by Marc Schumann <wurblzap@gmail.com>, r=vladd, a=myk
Diffstat (limited to 'editusers.cgi')
-rwxr-xr-xeditusers.cgi29
1 files changed, 26 insertions, 3 deletions
diff --git a/editusers.cgi b/editusers.cgi
index facb46600..9a4bfd5c0 100755
--- a/editusers.cgi
+++ b/editusers.cgi
@@ -460,9 +460,18 @@ if ($action eq 'search') {
$vars->{'longdescs'} = $dbh->selectrow_array(
'SELECT COUNT(*) FROM longdescs WHERE who = ?',
undef, $otherUserID);
- $vars->{'namedqueries'} = $dbh->selectrow_array(
- 'SELECT COUNT(*) FROM namedqueries WHERE userid = ?',
- undef, $otherUserID);
+ $vars->{'namedqueries'} = $dbh->selectcol_arrayref(
+ 'SELECT id FROM namedqueries WHERE userid = ?',
+ undef,
+ $otherUserID);
+ if (@{$vars->{'namedqueries'}}) {
+ $vars->{'namedquery_group_map'} = $dbh->selectrow_array(
+ 'SELECT COUNT(*) FROM namedquery_group_map WHERE namedquery_id IN' .
+ ' (' . join(', ', @{$vars->{'namedqueries'}}) . ')');
+ }
+ else {
+ $vars->{'namedquery_group_map'} = 0;
+ }
$vars->{'profile_setting'} = $dbh->selectrow_array(
'SELECT COUNT(*) FROM profile_setting WHERE user_id = ?',
undef, $otherUserID);
@@ -525,6 +534,8 @@ if ($action eq 'search') {
'flagtypes READ',
'cc WRITE',
'namedqueries WRITE',
+ 'namedqueries_link_in_footer WRITE',
+ 'namedquery_group_map WRITE',
'tokens WRITE',
'votes WRITE',
'watch WRITE',
@@ -545,6 +556,12 @@ if ($action eq 'search') {
Bugzilla->logout_user($otherUser);
+ # Get the named query list so we can delete namedquery_group_map entries.
+ my $namedqueries_as_string = join(', ', $dbh->selectcol_arrayref(
+ 'SELECT id FROM namedqueries WHERE userid = ?',
+ undef,
+ $otherUserID));
+
# Get the timestamp for LogActivityEntry.
my $timestamp = $dbh->selectrow_array('SELECT NOW()');
@@ -589,6 +606,12 @@ if ($action eq 'search') {
$otherUserID);
$dbh->do('DELETE FROM logincookies WHERE userid = ?', undef, $otherUserID);
$dbh->do('DELETE FROM namedqueries WHERE userid = ?', undef, $otherUserID);
+ $dbh->do('DELETE FROM namedqueries_link_in_footer WHERE user_id = ?', undef,
+ $otherUserID);
+ if ($namedqueries_as_string) {
+ $dbh->do('DELETE FROM namedquery_group_map WHERE namedquery_id IN ' .
+ "($namedqueries_as_string)");
+ }
$dbh->do('DELETE FROM profile_setting WHERE user_id = ?', undef,
$otherUserID);
$dbh->do('DELETE FROM profiles_activity WHERE userid = ? OR who = ?', undef,