1: | <?php |
2: | |
3: | |
4: | |
5: | |
6: | |
7: | |
8: | namespace Aurora\Modules\OverrideUserSettings; |
9: | |
10: | |
11: | |
12: | |
13: | |
14: | |
15: | |
16: | |
17: | class Module extends \Aurora\System\Module\AbstractModule |
18: | { |
19: | public function init() |
20: | { |
21: | $this->subscribeEvent('Core::CreateUser::after', array($this, 'onAfterCreateUser')); |
22: | } |
23: | |
24: | public function onAfterCreateUser(&$aArgs, &$mResult) |
25: | { |
26: | $iUserId = isset($mResult) && (int) $mResult > 0 ? (int) $mResult : 0; |
27: | if ($iUserId > 0) { |
28: | $oUser = \Aurora\Modules\Core\Module::Decorator()->GetUserUnchecked($iUserId); |
29: | |
30: | if ($oUser) { |
31: | $aDomains = $this->getConfig('Domains', []); |
32: | if (is_array($aDomains) && !empty($aDomains)) { |
33: | $sUserDomain = \MailSo\Base\Utils::GetDomainFromEmail($oUser->PublicId); |
34: | foreach ($aDomains as $aDomain) { |
35: | if ($aDomain["name"] === $sUserDomain && isset($aDomain["modules"]) && is_array($aDomain["modules"])) { |
36: | foreach ($aDomain["modules"] as $sModuleName) { |
37: | $oUser->disableModule($sModuleName); |
38: | \Aurora\Modules\Core\Module::Decorator()->UpdateUserObject($oUser); |
39: | } |
40: | } |
41: | } |
42: | } |
43: | } |
44: | } |
45: | } |
46: | } |
47: | |