Exceptions configuration for black list plugin.

This commit is contained in:
RainLoop Team 2013-12-10 16:05:55 +04:00
parent 54a522f7e4
commit 5d5cab6afe
2 changed files with 14 additions and 6 deletions

View file

@ -1 +1 @@
1.0 1.1

View file

@ -18,12 +18,16 @@ class BlackListPlugin extends \RainLoop\Plugins\AbstractPlugin
{ {
if (\RainLoop\Plugins\Helper::ValidateWildcardValues($sEmail, if (\RainLoop\Plugins\Helper::ValidateWildcardValues($sEmail,
$this->Config()->Get('plugin', 'black_list', ''))) $this->Config()->Get('plugin', 'black_list', '')))
{
$sExceptions = \trim($this->Config()->Get('plugin', 'exceptions', ''));
if (0 === strlen($sExceptions) || !\RainLoop\Plugins\Helper::ValidateWildcardValues($sEmail, $sExceptions))
{ {
throw new \RainLoop\Exceptions\ClientException( throw new \RainLoop\Exceptions\ClientException(
$this->Config()->Get('plugin', 'auth_error', true) ? $this->Config()->Get('plugin', 'auth_error', true) ?
\RainLoop\Notifications::AuthError : \RainLoop\Notifications::AccountNotAllowed); \RainLoop\Notifications::AuthError : \RainLoop\Notifications::AccountNotAllowed);
} }
} }
}
/** /**
* @return array * @return array
@ -37,8 +41,12 @@ class BlackListPlugin extends \RainLoop\Plugins\AbstractPlugin
->SetDefaultValue(true), ->SetDefaultValue(true),
\RainLoop\Plugins\Property::NewInstance('black_list')->SetLabel('Black List') \RainLoop\Plugins\Property::NewInstance('black_list')->SetLabel('Black List')
->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT) ->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT)
->SetDescription('Emails black list , space as delimiter, wildcard supported.') ->SetDescription('Emails black list, space as delimiter, wildcard supported.')
->SetDefaultValue('*@domain1.com user@domain2.com') ->SetDefaultValue('*@domain1.com user@domain2.com'),
\RainLoop\Plugins\Property::NewInstance('exceptions')->SetLabel('Exceptions')
->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT)
->SetDescription('Exceptions for black list, space as delimiter, wildcard supported.')
->SetDefaultValue('demo@domain1.com test-*@domain2.com admin@*')
); );
} }
} }