]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/User_group.php
Add README with intallation/upgrade instructions to the Facebook Bridge plugin
[quix0rs-gnu-social.git] / classes / User_group.php
index cffc7864586d7a542764fcb1ec3d621725ca6ee1..68f61cb7f48a104b43aae7b84fcf5ba4503d7ca3 100644 (file)
@@ -476,6 +476,16 @@ class User_group extends Memcached_DataObject
     }
 
     static function register($fields) {
+        if (!empty($fields['userid'])) {
+            $profile = Profile::staticGet('id', $fields['userid']);
+            if ($profile && !$profile->hasRight(Right::CREATEGROUP)) {
+                common_log(LOG_WARNING, "Attempted group creation from banned user: " . $profile->nickname);
+
+                // TRANS: Client exception thrown when a user tries to create a group while banned.
+                throw new ClientException(_('You are not allowed to create groups on this site.'), 403);
+            }
+        }
+
         // MAGICALLY put fields into current scope
 
         extract($fields);