refactor(arch): enforce gateway compliance and remove service-wrapping gateways
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
namespace MintyPHP\Service\Auth;
|
||||
|
||||
use MintyPHP\Service\Access\AccessServicesFactory;
|
||||
use MintyPHP\Service\Access\PermissionGateway;
|
||||
use MintyPHP\Service\Access\PermissionService;
|
||||
use MintyPHP\Service\Settings\SettingsApiPolicyGateway;
|
||||
use MintyPHP\Service\Settings\SettingsAppGateway;
|
||||
use MintyPHP\Service\Settings\SettingsDefaultsGateway;
|
||||
@@ -11,7 +11,6 @@ use MintyPHP\Service\Settings\SettingServicesFactory;
|
||||
use MintyPHP\Service\Settings\SettingsLoginPersistenceGateway;
|
||||
use MintyPHP\Service\Settings\SettingsMicrosoftGateway;
|
||||
use MintyPHP\Service\Tenant\TenantScopeService;
|
||||
use MintyPHP\Service\User\UserServicesFactory;
|
||||
|
||||
class AuthGatewayFactory
|
||||
{
|
||||
@@ -20,21 +19,15 @@ class AuthGatewayFactory
|
||||
private ?SettingsDefaultsGateway $settingsDefaultsGateway = null;
|
||||
private ?SettingsAppGateway $settingsAppGateway = null;
|
||||
private ?SettingsLoginPersistenceGateway $settingsLoginPersistenceGateway = null;
|
||||
private ?PermissionGateway $permissionGateway = null;
|
||||
private ?PermissionService $permissionService = 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
|
||||
) {
|
||||
@@ -51,14 +44,14 @@ class AuthGatewayFactory
|
||||
);
|
||||
}
|
||||
|
||||
public function createAuthScopeGateway(): AuthScopeGateway
|
||||
public function getTenantScopeService(): TenantScopeService
|
||||
{
|
||||
return $this->authScopeGateway ??= new AuthScopeGateway($this->tenantScopeService);
|
||||
return $this->tenantScopeService;
|
||||
}
|
||||
|
||||
public function createAuthPermissionGateway(): AuthPermissionGateway
|
||||
public function createPermissionService(): PermissionService
|
||||
{
|
||||
return $this->authPermissionGateway ??= new AuthPermissionGateway($this->createPermissionGateway());
|
||||
return $this->permissionService ??= $this->accessServicesFactory->createPermissionService();
|
||||
}
|
||||
|
||||
public function createAuthTenantGateway(): AuthTenantGateway
|
||||
@@ -73,25 +66,6 @@ class AuthGatewayFactory
|
||||
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(
|
||||
@@ -99,11 +73,6 @@ class AuthGatewayFactory
|
||||
);
|
||||
}
|
||||
|
||||
private function createPermissionGateway(): PermissionGateway
|
||||
{
|
||||
return $this->permissionGateway ??= $this->accessServicesFactory->createPermissionGateway();
|
||||
}
|
||||
|
||||
private function createSettingsMicrosoftGateway(): SettingsMicrosoftGateway
|
||||
{
|
||||
return $this->settingsMicrosoftGateway ??= $this->settingServicesFactory->createSettingsMicrosoftGateway();
|
||||
|
||||
Reference in New Issue
Block a user