1: <?php
2: /**
3: * This code is licensed under AGPLv3 license or Afterlogic Software License
4: * if commercial version of the product was purchased.
5: * For full statements of the licenses see LICENSE-AFTERLOGIC and LICENSE-AGPL3 files.
6: */
7:
8: namespace Aurora\Modules\CoreExtender;
9:
10: /**
11: * Provides user groups.
12: *
13: * @license https://www.gnu.org/licenses/agpl-3.0.html AGPL-3.0
14: * @license https://afterlogic.com/products/common-licensing Afterlogic Software License
15: * @copyright Copyright (c) 2023, Afterlogic Corp.
16: *
17: * @property Settings $oModuleSettings
18: *
19: * @package Modules
20: */
21: class Module extends \Aurora\System\Module\AbstractModule
22: {
23: public function init()
24: {
25: $this->subscribeEvent('Core::SetAuthDataAndGetAuthToken::after', array($this, 'onAfterAuthenticate'), 10);
26: }
27:
28: /**
29: * @return Module
30: */
31: public static function getInstance()
32: {
33: return parent::getInstance();
34: }
35:
36: /**
37: * @return Module
38: */
39: public static function Decorator()
40: {
41: return parent::Decorator();
42: }
43:
44: /**
45: * @return Settings
46: */
47: public function getModuleSettings()
48: {
49: return $this->oModuleSettings;
50: }
51:
52: public function onAfterAuthenticate(&$aArgs, &$mResult)
53: {
54: if ($mResult && is_array($mResult) && isset($mResult[\Aurora\System\Application::AUTH_TOKEN_KEY])) {
55: $sXClientHeader = (string) \MailSo\Base\Http::SingletonInstance()->GetHeader('X-Client');
56:
57: if (strtolower($sXClientHeader) !== 'webclient') {
58: $mResult['AllowAccess'] = 1;
59: }
60: }
61: }
62: }
63: