major update
This commit is contained in:
98
lib/Service/Auth/AuthGatewayFactory.php
Normal file
98
lib/Service/Auth/AuthGatewayFactory.php
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Service\Auth;
|
||||
|
||||
use MintyPHP\Service\Access\AccessServicesFactory;
|
||||
use MintyPHP\Service\Access\PermissionGateway;
|
||||
use MintyPHP\Service\Settings\SettingGateway;
|
||||
use MintyPHP\Service\Settings\SettingServicesFactory;
|
||||
use MintyPHP\Service\Tenant\TenantScopeService;
|
||||
use MintyPHP\Service\User\UserServicesFactory;
|
||||
|
||||
class AuthGatewayFactory
|
||||
{
|
||||
private ?SettingGateway $settingGateway = null;
|
||||
private ?PermissionGateway $permissionGateway = null;
|
||||
private ?AuthSettingsGateway $authSettingsGateway = null;
|
||||
private ?AuthScopeGateway $authScopeGateway = null;
|
||||
private ?AuthPermissionGateway $authPermissionGateway = null;
|
||||
private ?AuthTenantGateway $authTenantGateway = null;
|
||||
private ?AuthCryptoGateway $authCryptoGateway = null;
|
||||
private ?AuthTenantSsoGateway $authTenantSsoGateway = null;
|
||||
private ?AuthSavedFilterGateway $authSavedFilterGateway = null;
|
||||
private ?AuthAvatarGateway $authAvatarGateway = null;
|
||||
private ?AuthExternalIdentityGateway $authExternalIdentityGateway = null;
|
||||
|
||||
public function __construct(
|
||||
private readonly AuthRepositoryFactory $authRepositoryFactory,
|
||||
private readonly AccessServicesFactory $accessServicesFactory,
|
||||
private readonly UserServicesFactory $userServicesFactory,
|
||||
private readonly SettingServicesFactory $settingServicesFactory,
|
||||
private readonly TenantScopeService $tenantScopeService
|
||||
) {
|
||||
}
|
||||
|
||||
public function createAuthSettingsGateway(): AuthSettingsGateway
|
||||
{
|
||||
return $this->authSettingsGateway ??= new AuthSettingsGateway($this->createSettingGateway());
|
||||
}
|
||||
|
||||
public function createAuthScopeGateway(): AuthScopeGateway
|
||||
{
|
||||
return $this->authScopeGateway ??= new AuthScopeGateway($this->tenantScopeService);
|
||||
}
|
||||
|
||||
public function createAuthPermissionGateway(): AuthPermissionGateway
|
||||
{
|
||||
return $this->authPermissionGateway ??= new AuthPermissionGateway($this->createPermissionGateway());
|
||||
}
|
||||
|
||||
public function createAuthTenantGateway(): AuthTenantGateway
|
||||
{
|
||||
return $this->authTenantGateway ??= new AuthTenantGateway(
|
||||
$this->authRepositoryFactory->createTenantRepository()
|
||||
);
|
||||
}
|
||||
|
||||
public function createAuthCryptoGateway(): AuthCryptoGateway
|
||||
{
|
||||
return $this->authCryptoGateway ??= new AuthCryptoGateway();
|
||||
}
|
||||
|
||||
public function createAuthTenantSsoGateway(TenantSsoService $tenantSsoService): AuthTenantSsoGateway
|
||||
{
|
||||
return $this->authTenantSsoGateway ??= new AuthTenantSsoGateway($tenantSsoService);
|
||||
}
|
||||
|
||||
public function createAuthSavedFilterGateway(): AuthSavedFilterGateway
|
||||
{
|
||||
return $this->authSavedFilterGateway ??= new AuthSavedFilterGateway(
|
||||
$this->userServicesFactory->createUserSavedFilterService()
|
||||
);
|
||||
}
|
||||
|
||||
public function createAuthAvatarGateway(): AuthAvatarGateway
|
||||
{
|
||||
return $this->authAvatarGateway ??= new AuthAvatarGateway(
|
||||
$this->userServicesFactory->createUserAvatarService()
|
||||
);
|
||||
}
|
||||
|
||||
public function createAuthExternalIdentityGateway(): AuthExternalIdentityGateway
|
||||
{
|
||||
return $this->authExternalIdentityGateway ??= new AuthExternalIdentityGateway(
|
||||
$this->authRepositoryFactory->createUserExternalIdentityRepository()
|
||||
);
|
||||
}
|
||||
|
||||
private function createPermissionGateway(): PermissionGateway
|
||||
{
|
||||
return $this->permissionGateway ??= $this->accessServicesFactory->createPermissionGateway();
|
||||
}
|
||||
|
||||
private function createSettingGateway(): SettingGateway
|
||||
{
|
||||
return $this->settingGateway ??= $this->settingServicesFactory->createSettingGateway();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user