Ticket #2999: RequireValidatedEmail plugin now also prevents group creation by unvalidated users.
This commit is contained in:
parent
1543af748c
commit
7c3f820ff0
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user