From 7c3f820ff0047d0e223832477c5879a50a87a8e1 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 20 Jan 2011 13:05:58 -0800 Subject: [PATCH] Ticket #2999: RequireValidatedEmail plugin now also prevents group creation by unvalidated users. --- .../RequireValidatedEmailPlugin.php | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php b/plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php index 6c0ef37d51..980b7beb6e 100644 --- a/plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php +++ b/plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php @@ -235,4 +235,24 @@ class RequireValidatedEmailPlugin extends Plugin } return true; } + + /** + * Prevent unvalidated folks from creating spam groups. + * + * @param Profile $profile User profile we're checking + * @param string $right rights key + * @param boolean $result if overriding, set to true/false has right + * @return boolean hook result value + */ + function onUserRightsCheck(Profile $profile, $right, &$result) + { + if ($right == Right::CREATEGROUP) { + $user = User::staticGet('id', $profile->id); + if ($user && !$this->validated($user)) { + $result = false; + return false; + } + } + return true; + } } -- 2.39.5