Initial commit
This commit is contained in:
59
application/Espo/Core/Portal/Loaders/Acl.php
Normal file
59
application/Espo/Core/Portal/Loaders/Acl.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Portal\Loaders;
|
||||
|
||||
use Espo\Core\Portal\AclManager as PortalAclManager;
|
||||
use Espo\Core\AclManager;
|
||||
use Espo\Core\Container\Loader;
|
||||
use Espo\Core\Portal\Acl as AclService;
|
||||
use Espo\Entities\User;
|
||||
|
||||
use InvalidArgumentException;
|
||||
|
||||
class Acl implements Loader
|
||||
{
|
||||
private PortalAclManager $aclManager;
|
||||
private User $user;
|
||||
|
||||
public function __construct(AclManager $aclManager, User $user)
|
||||
{
|
||||
if (!$aclManager instanceof PortalAclManager) {
|
||||
throw new InvalidArgumentException();
|
||||
}
|
||||
|
||||
$this->aclManager = $aclManager;
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
public function load(): AclService
|
||||
{
|
||||
return new AclService($this->aclManager, $this->user);
|
||||
}
|
||||
}
|
||||
50
application/Espo/Core/Portal/Loaders/AclManager.php
Normal file
50
application/Espo/Core/Portal/Loaders/AclManager.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Portal\Loaders;
|
||||
|
||||
use Espo\Core\AclManager as InternalAclManager;
|
||||
use Espo\Core\Container\Loader;
|
||||
use Espo\Core\InjectableFactory;
|
||||
use Espo\Core\Portal\AclManager as PortalAclManager;
|
||||
|
||||
class AclManager implements Loader
|
||||
{
|
||||
public function __construct(
|
||||
private InjectableFactory $injectableFactory,
|
||||
private InternalAclManager $internalAclManager
|
||||
) {}
|
||||
|
||||
public function load(): PortalAclManager
|
||||
{
|
||||
return $this->injectableFactory->createWith(PortalAclManager::class,[
|
||||
'internalAclManager' => $this->internalAclManager,
|
||||
]);
|
||||
}
|
||||
}
|
||||
45
application/Espo/Core/Portal/Loaders/InternalAclManager.php
Normal file
45
application/Espo/Core/Portal/Loaders/InternalAclManager.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Portal\Loaders;
|
||||
|
||||
use Espo\Core\AclManager as InternalAclManagerService;
|
||||
use Espo\Core\Container\Loader;
|
||||
use Espo\Core\InjectableFactory;
|
||||
|
||||
class InternalAclManager implements Loader
|
||||
{
|
||||
public function __construct(private InjectableFactory $injectableFactory)
|
||||
{}
|
||||
|
||||
public function load(): InternalAclManagerService
|
||||
{
|
||||
return $this->injectableFactory->create(InternalAclManagerService::class);
|
||||
}
|
||||
}
|
||||
54
application/Espo/Core/Portal/Loaders/Language.php
Normal file
54
application/Espo/Core/Portal/Loaders/Language.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2025 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Portal\Loaders;
|
||||
|
||||
use Espo\Core\Container\Loader;
|
||||
use Espo\Core\InjectableFactory;
|
||||
use Espo\Core\Portal\Utils\Language as LanguageService;
|
||||
use Espo\Core\Utils\Config;
|
||||
|
||||
use Espo\Entities\Preferences;
|
||||
|
||||
class Language implements Loader
|
||||
{
|
||||
public function __construct(
|
||||
private InjectableFactory $injectableFactory,
|
||||
private Config $config,
|
||||
private Preferences $preferences
|
||||
) {}
|
||||
|
||||
public function load(): LanguageService
|
||||
{
|
||||
return $this->injectableFactory->createWith(LanguageService::class, [
|
||||
'language' => LanguageService::detectLanguage($this->config, $this->preferences),
|
||||
'useCache' => $this->config->get('useCache') ?? false,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user