New permission 'sendemail' added. Default right for all registered users. Can for...
authorSiebrand Mazeland <siebrand@users.mediawiki.org>
Sat, 26 Sep 2009 23:11:45 +0000 (23:11 +0000)
committerSiebrand Mazeland <siebrand@users.mediawiki.org>
Sat, 26 Sep 2009 23:11:45 +0000 (23:11 +0000)
* hide some user settings if user is not allowed to send e-mail, but can receive e-mail
* update API 'cannot send e-mail' message
* FIXME: gives 'mailnologin'/'mailnologintext' as error. Error handling should be made more fine grained

RELEASE-NOTES
includes/DefaultSettings.php
includes/Preferences.php
includes/User.php
includes/api/ApiBase.php
includes/specials/SpecialEmailuser.php
languages/messages/MessagesEn.php
maintenance/language/messages.inc

index ff4f76a..2a1e5ad 100644 (file)
@@ -230,16 +230,18 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Added $wgUseAJAXCategories allow enabling AJAX based categories system.
   This works on all namespaces. Enabled namespaces can be reduces using
   $wgAJAXCategoriesNamespaces.
-* Admins could disable some variants using $wgDisabledVariants now. ONLY apply on
-  wikis enabled LanguageConverter.
-* A new permission, 'root', is created.  Analogous to root users on Unix systems,
-  the root permission effectively grants all other permissions on a wiki.  Useful
-  for debugging and administration.
-* New configuration variable $wgShowPageOnRedlink that can be set to show the page
-  instead of an edit interface when visiting a red link. The value can be specified
-  for specific usergroups and namespaces.
+* Admins could disable some variants using $wgDisabledVariants now. ONLY apply
+  on wikis enabled LanguageConverter.
+* A new permission, 'root', is created.  Analogous to root users on Unix
+  systems, the root permission effectively grants all other permissions on a
+  wiki. Useful for debugging and administration.
+* New configuration variable $wgShowPageOnRedlink that can be set to show the
+  page instead of an edit interface when visiting a red link. The value can be
+  specified for specific usergroups and namespaces.
 * (bug 16310) Credits page now lists IP addresses rather than saying the number
   of anonymous users that edited the page
+* New permission 'sendemail' added. Default right for all registered users. Can
+  for example be used to prevent new accounts from sending spam.
 
 === Bug fixes in 1.16 ===
 
@@ -530,10 +532,10 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 20702) Parser functions can now be used correctly in
   MediaWiki:Missing-article
 * (bug 14117) "redirected from" is now also shown on foreign file redirects
-* (bug 18436) JavaScript-added AJAX messages (from the JS watch/unwatch, for 
+* (bug 18436) JavaScript-added AJAX messages (from the JS watch/unwatch, for
   instance) no longer include a redundant "display:block" hardcoded style.
 * (bug 20802) Fixed thumb.php redirect handling
-* (bug 17747) Only display thumbnail column in file history if the image can 
+* (bug 17747) Only display thumbnail column in file history if the image can
   be rendered.
 * (bug 3421) Live preview no longer breaks user CSS/JS previews
 * (bug 11264) The file logo on a file description page for documents (PDF, ...)
index a4050d2..e90b156 100644 (file)
@@ -1332,6 +1332,7 @@ $wgGroupPermissions['user']['reupload']         = true;
 $wgGroupPermissions['user']['reupload-shared']  = true;
 $wgGroupPermissions['user']['minoredit']        = true;
 $wgGroupPermissions['user']['purge']            = true; // can use ?action=purge without clicking "ok"
+$wgGroupPermissions['user']['sendemail']        = true;
 
 // Implicit group for accounts that pass $wgAutoConfirmAge
 $wgGroupPermissions['autoconfirmed']['autoconfirmed'] = true;
index 92a9141..196b83b 100644 (file)
@@ -389,7 +389,7 @@ class Preferences {
        
                        }
        
-                       if( $wgEnableUserEmail ) {
+                       if( $wgEnableUserEmail && $user->isAllowed( 'sendemail' ) ) {
                                $defaultPreferences['disablemail'] =
                                                array(
                                                        'type' => 'toggle',
index f599d76..4b1972e 100644 (file)
@@ -2983,8 +2983,8 @@ class User {
         * @return \bool True if allowed
         */
        function canSendEmail() {
-               global $wgEnableEmail, $wgEnableUserEmail;
-               if( !$wgEnableEmail || !$wgEnableUserEmail ) {
+               global $wgEnableEmail, $wgEnableUserEmail, $wgUser;
+               if( !$wgEnableEmail || !$wgEnableUserEmail || !$wgUser->isAllowed( 'sendemail' ) ) {
                        return false;
                }
                $canSend = $this->isEmailConfirmed();
index ecefe84..04c141a 100644 (file)
@@ -792,7 +792,7 @@ abstract class ApiBase {
                'ipb_already_blocked' => array('code' => 'alreadyblocked', 'info' => "The user you tried to block was already blocked"),
                'ipb_blocked_as_range' => array('code' => 'blockedasrange', 'info' => "IP address ``\$1'' was blocked as part of range ``\$2''. You can't unblock the IP invidually, but you can unblock the range as a whole."),
                'ipb_cant_unblock' => array('code' => 'cantunblock', 'info' => "The block you specified was not found. It may have been unblocked already"),
-               'mailnologin' => array('code' => 'cantsend', 'info' => "You're not logged in or you don't have a confirmed e-mail address, so you can't send e-mail"),
+               'mailnologin' => array('code' => 'cantsend', 'info' => "You are not logged in, you do not have a confirmed e-mail address, or you are not allowed to send e-mail to other users, so you cannot send e-mail"),
                'usermaildisabled' => array('code' => 'usermaildisabled', 'info' => "User email has been disabled"),
                'blockedemailuser' => array('code' => 'blockedfrommail', 'info' => "You have been blocked from sending e-mail"),
                'notarget' => array('code' => 'notarget', 'info' => "You have not specified a valid target for this action"),
index 5bf2b57..def16c0 100644 (file)
@@ -290,6 +290,10 @@ class EmailUserForm {
        static function getPermissionsError ( $user, $editToken ) {
                if( !$user->canSendEmail() ) {
                        wfDebug( "User can't send.\n" );
+                       // FIXME: this is also the error if user is in a group
+                       //        that is not allowed to send e-mail (no right
+                       //        'sendemail'). Error messages should probably
+                       //        be more fine grained.
                        return "mailnologin";
                }
                
index 284a5be..72773f2 100644 (file)
@@ -1931,6 +1931,7 @@ You can also choose to let others contact you through your user or talk page wit
 'right-override-export-depth' => 'Export pages including linked pages up to a depth of 5',
 'right-versiondetail'         => 'Show the extended software version information',
 'right-root'                  => 'Perform all actions on the wiki',
+'right-sendemail'             => 'Send e-mail to other users',
 
 # User rights log
 'rightslog'      => 'User rights log',
index 86aa8d4..42e5c9a 100644 (file)
@@ -1111,6 +1111,7 @@ $wgMessageStructure = array(
                'right-override-export-depth',
                'right-versiondetail',
                'right-root',
+               'right-sendemail',
        ),
        'rightslog' => array(
                'rightslog',