ElkArte Community

Title: Require verification based on white/blacklisting groups
Post by: Joshua Dickerson on July 10, 2015, 04:48:16 pm
I think it should have two lists: a white list and a black list. Each list is of groups. Then, you create a group (eg 20_posts_plus_group) and add that group to the white list. For moderators, you just add all moderators to the moderators group and then add them to the white list. This gives you much greater control.

Then, create a function (I did this in Notepad in a few seconds so it's just a concept):

Code: [Select]
var_dump(requiresPostVerification($user_info['groups']));

// Admin, Global Moderator, Moderator
$modSettings['post_verification_whitelist'] = [1, 2, 3];
// Default Newbie Group and Guest
$modSettings['post_verification_blacklist'] = [-1, 4];

/**
 * Check if a user is required to answer a human verification question
 * @param array $groups The user's groups
 * @return bool
 */
function requiresPostVerification(array $groups)
{
$whitelist = $GLOBALS['modSettings']['post_verficiation_whitelist'] ?: $GLOBALS['modSettings']['post_verficiation_whitelist'];
$blacklist = $GLOBALS['modSettings']['post_verification_blacklist'] ?: $GLOBALS['modSettings']['post_verification_blacklist'];

// Don't worry about the whitelist if they are on the blacklist. We want to be overly cautious
if (!empty($blacklist) && array() !== array_intersect($blacklist, $groups))
{
return true;
}

if (!empty($whitelist) && array() !== array_intersect($whitelist, $groups))
{
return true;
}

return false;
}
Title: Re: Require verification based on white/blacklisting groups
Post by: Joshua Dickerson on July 10, 2015, 05:15:32 pm
Also, create_control_verification() should not return errors or a bool. It is polluting $context['require_verification'] which should only be a bool.
Title: Re: Require verification based on white/blacklisting groups
Post by: Burke Knight on July 10, 2015, 05:28:37 pm
I'm not certain all that is needed.
The only groups that should be exempt, are Admins, Global Moderators, and maybe regular moderators, IMHO.
Title: Re: Require verification based on white/blacklisting groups
Post by: emanuele on July 31, 2015, 05:46:55 pm
xref: https://github.com/elkarte/Elkarte/issues/363