Alexander Nicolaysen Sørnes : Allow admins to disable global email notifications
Alexander Nicolaysen Sørnes
asornes at winehq.org
Thu Nov 12 17:18:41 CST 2009
Module: appdb
Branch: master
Commit: dc06f730ca50e8ed575283c3d855e5cae9c3a6e7
URL: http://source.winehq.org/git/appdb.git/?a=commit;h=dc06f730ca50e8ed575283c3d855e5cae9c3a6e7
Author: Alexander Nicolaysen Sørnes <alexander at linux-xqqm.(none)>
Date: Thu Nov 12 21:05:19 2009 +0100
Allow admins to disable global email notifications
---
include/user.php | 5 +++--
preferences.php | 4 ++++
tables/prefs_list.sql | 24 +++++++++++++-----------
3 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/include/user.php b/include/user.php
index 73d47eb..212b331 100644
--- a/include/user.php
+++ b/include/user.php
@@ -579,8 +579,9 @@ class User {
$i = array_search($oRow->userid, $aUserId);
// if we didn't find this entry in the $aUserId
- // array then we should add it
- if($i === false)
+ // array then we should add it if the admin has
+ // enabled global emails
+ if($i === false && ($this->getPref('disable_global_emails','no') == 'no'))
$aUserId[] = $oRow->userid;
}
}
diff --git a/preferences.php b/preferences.php
index 962939a..103ba72 100644
--- a/preferences.php
+++ b/preferences.php
@@ -51,6 +51,10 @@ function build_prefs_list($oUser)
continue;
}
+ /* Check if the permission only applies to a specific group */
+ if($r->show_for_group && !$_SESSION['current']->hasPriv($r->show_for_group))
+ continue;
+
$input = html_select("pref_$r->name", explode('|', $r->value_list),
$oUser->getpref($r->name, $r->def_value));
diff --git a/tables/prefs_list.sql b/tables/prefs_list.sql
index 1952a03..df9a946 100644
--- a/tables/prefs_list.sql
+++ b/tables/prefs_list.sql
@@ -8,18 +8,20 @@ CREATE TABLE prefs_list (
def_value text,
value_list text,
description text,
+ show_for_group text,
primary key(id)
);
-INSERT INTO prefs_list VALUES (0, 'debug', 'no', 'yes|no', 'Enable debugging information');
-INSERT INTO prefs_list VALUES (0, 'sidebar', 'left', 'left|right', 'Sidebar location');
-INSERT INTO prefs_list VALUES (0, 'window:query', 'no', 'yes|no', 'Display query results in a new window');
-INSERT INTO prefs_list VALUES (0, 'window:help', 'no', 'yes|no', 'Display help in a new window');
-INSERT INTO prefs_list VALUES (0, 'window:offsite', 'no', 'yes|no', 'Display offsite URLs in a new window');
-INSERT INTO prefs_list VALUES (0, 'confirm_comment_deletion', 'yes', 'yes|no', 'Ask why you are deleting a comment before deleting it');
-INSERT INTO prefs_list VALUES (0, 'query:mode', 'view', 'view|edit', 'Default API details mode');
-INSERT INTO prefs_list VALUES (0, 'query:hide_header', 'no', 'yes|no', 'Hide apidb header in query results');
-INSERT INTO prefs_list VALUES (0, 'query:hide_sidebar', 'no', 'yes|no', 'Hide apidb sidebar in query results');
-INSERT INTO prefs_list VALUES (0, 'send_email', 'yes', 'yes|no', 'Send email notifications');
-INSERT INTO prefs_list VALUES (0, 'htmleditor', 'for supported browsers', 'always|for supported browsers|never', 'Display a graphical HTML editor in certain text fields');
+INSERT INTO prefs_list (name,def_value,value_list,description) VALUES ('debug', 'no', 'yes|no', 'Enable debugging information');
+INSERT INTO prefs_list (name,def_value,value_list,description) VALUES ('sidebar', 'left', 'left|right', 'Sidebar location');
+INSERT INTO prefs_list (name,def_value,value_list,description) VALUES ('window:query', 'no', 'yes|no', 'Display query results in a new window');
+INSERT INTO prefs_list (name,def_value,value_list,description) VALUES ('window:help', 'no', 'yes|no', 'Display help in a new window');
+INSERT INTO prefs_list (name,def_value,value_list,description) VALUES ('window:offsite', 'no', 'yes|no', 'Display offsite URLs in a new window');
+INSERT INTO prefs_list (name,def_value,value_list,description) VALUES ('confirm_comment_deletion', 'yes', 'yes|no', 'Ask why you are deleting a comment before deleting it');
+INSERT INTO prefs_list (name,def_value,value_list,description) VALUES ('query:mode', 'view', 'view|edit', 'Default API details mode');
+INSERT INTO prefs_list (name,def_value,value_list,description) VALUES ('query:hide_header', 'no', 'yes|no', 'Hide apidb header in query results');
+INSERT INTO prefs_list (name,def_value,value_list,description) VALUES ('query:hide_sidebar', 'no', 'yes|no', 'Hide apidb sidebar in query results');
+INSERT INTO prefs_list (name,def_value,value_list,description) VALUES ('send_email', 'yes', 'yes|no', 'Send email notifications');
+INSERT INTO prefs_list (name,def_value,value_list,description) VALUES ('htmleditor', 'for supported browsers', 'always|for supported browsers|never', 'Display a graphical HTML editor in certain text fields');
+INSERT INTO prefs_list (name,def_value,value_list,description,show_for_group) VALUES ('disable_global_emails', 'no', 'yes|no', 'Disable global e-mail notifications (only send for maintained apps)', 'admin');
More information about the wine-cvs
mailing list