refactor(core): centralize reserved system user identity
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -14,6 +14,7 @@ use KTXC\Resource\ProviderManager;
|
||||
use KTXF\Mail\Provider\ProviderBaseInterface;
|
||||
use KTXF\Mail\Provider\ProviderServiceMutateInterface;
|
||||
use KTXF\Resource\Provider\ResourceServiceMutateInterface;
|
||||
use KTXF\Resource\SystemIdentity;
|
||||
use KTXM\ProviderMailSystem\Stores\ServiceStore;
|
||||
|
||||
/**
|
||||
@@ -108,7 +109,7 @@ class Provider implements ProviderBaseInterface, ProviderServiceMutateInterface
|
||||
{
|
||||
// routes are tenant scoped and only visible in the system user context,
|
||||
// keeping them out of regular user account listings
|
||||
if ($userId !== self::USER_SYSTEM) {
|
||||
if ($userId !== SystemIdentity::USER) {
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -122,7 +123,7 @@ class Provider implements ProviderBaseInterface, ProviderServiceMutateInterface
|
||||
|
||||
public function serviceFetch(string $tenantId, string $userId, string|int $identifier): ?Service
|
||||
{
|
||||
if ($userId !== self::USER_SYSTEM) {
|
||||
if ($userId !== SystemIdentity::USER) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -147,7 +148,7 @@ class Provider implements ProviderBaseInterface, ProviderServiceMutateInterface
|
||||
if (!str_ends_with($address, self::ADDRESS_DOMAIN_SUFFIX)) {
|
||||
return null;
|
||||
}
|
||||
if ($userId !== self::USER_SYSTEM) {
|
||||
if ($userId !== SystemIdentity::USER) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -170,7 +171,7 @@ class Provider implements ProviderBaseInterface, ProviderServiceMutateInterface
|
||||
|
||||
public function serviceExtant(string $tenantId, string $userId, string|int ...$identifiers): array
|
||||
{
|
||||
if ($userId !== self::USER_SYSTEM) {
|
||||
if ($userId !== SystemIdentity::USER) {
|
||||
return array_fill_keys(array_map('strval', $identifiers), false);
|
||||
}
|
||||
|
||||
@@ -223,7 +224,7 @@ class Provider implements ProviderBaseInterface, ProviderServiceMutateInterface
|
||||
*/
|
||||
protected function assertSystemContext(string $userId): void
|
||||
{
|
||||
if ($userId !== self::USER_SYSTEM) {
|
||||
if ($userId !== SystemIdentity::USER) {
|
||||
throw new InvalidArgumentException('System mail routes can only be managed in the system user context');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user