Repo Interface für tests
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Architektur-Kompass
|
||||
|
||||
Letzte Aktualisierung: 2026-02-25
|
||||
Letzte Aktualisierung: 2026-03-04
|
||||
|
||||
## Ziel
|
||||
|
||||
@@ -34,8 +34,10 @@ Verbindliche Kurzregeln für Architekturentscheidungen.
|
||||
- In `pages/admin/**` keine `Factory::class`-Referenzen.
|
||||
- Request-Input in Actions nur über `requestInput()` lesen.
|
||||
- Validierungsfehler über `FormErrors` führen und für APIs mit `ApiResponse::validationFromFormErrors(...)` ausgeben.
|
||||
- In `pages/api/v1/**` kein direktes JSON-Body-Lesen über `ApiResponse::readJsonBody(...)`.
|
||||
- `Flash` nur für Redirect-/Outcome-Meldungen verwenden, nicht als primäre Validation-Struktur.
|
||||
- Listen-Endpoints in `pages/**/data().php` sind GET-only (`gridRequireGetRequest()`).
|
||||
- Query-Filter in `data().php` über `gridParseFilters(...)` + `filter-schema.php` normalisieren.
|
||||
- Grid-Query-Parameter (`limit`, `offset`, `order`, `dir`) in `data().php` über `gridQueryLimitOffset()` und `gridQueryOrderDir()` normalisieren.
|
||||
|
||||
## Instanziierungsregeln (MUSS)
|
||||
@@ -61,6 +63,13 @@ Verbindliche Kurzregeln für Architekturentscheidungen.
|
||||
- Für einzelne Views setzen Actions explizit `$viewAuth['page']` (bevorzugt über `UiCapabilityMap` + `UiAccessService::pageCapabilities()`).
|
||||
- In `templates/**` keine direkten `can('...')`- oder Permission-Key-Checks.
|
||||
|
||||
## Frontend-Page-Module (MUSS)
|
||||
|
||||
- In `pages/**` und `templates/**` sind inline `<script type="module">...</script>` ohne `src` verboten.
|
||||
- Seiteninitialisierung liegt in dedizierten ESM-Page-Modulen unter `web/js/pages/*`.
|
||||
- Pro Seite wird Konfiguration per `<script type="application/json" id="page-config-<page-key>">...</script>` bereitgestellt und im Modul über `readPageConfig(...)` gelesen.
|
||||
- In `pages/**` und `templates/**` muessen alle JS-`src` (eigene und Vendor) ueber `assetVersion('...js...')` laufen.
|
||||
|
||||
## Mindestchecks vor Merge
|
||||
|
||||
```bash
|
||||
@@ -80,6 +89,7 @@ Struktur-Gates zusätzlich:
|
||||
(rg -n '\bDB::' pages -g '*.php' || true) | wc -l
|
||||
(rg -n 'app\([^\n]*Factory::class\)->create' pages/admin -g '*.php' || true) | wc -l
|
||||
(rg -n 'Factory::class' pages/admin -g '*.php' || true) | wc -l
|
||||
(rg -n 'ApiResponse::readJsonBody\(' pages/api/v1 -g '*.php' || true) | wc -l
|
||||
```
|
||||
|
||||
Architektur-Contract:
|
||||
|
||||
@@ -38,6 +38,9 @@ Kurze Definition of Done vor Merge.
|
||||
- [ ] Aktive Filter-Chips vorhanden (`data-active-filter-chips`) und Remove/Clear funktionieren
|
||||
- [ ] Kein Legacy-Toggle in Listen (`data-toolbar-toggle`, `data-filter-overflow`, `data-filter-toggle`)
|
||||
- [ ] Falls Save-Filter vorhanden: gespeicherter Zustand stammt aus Applied State (`gridConfig.baseUrl()`)
|
||||
- [ ] Keine inline `<script type="module">`-Blöcke in `pages/**`/`templates/**`; Seitenlogik liegt in `web/js/pages/*`
|
||||
- [ ] Für Seitenmodule ist Config über `<script type="application/json" id="page-config-...">` bereitgestellt
|
||||
- [ ] JS-`src` in `pages/**`/`templates/**` nur über `assetVersion('...js...')`
|
||||
- [ ] Service-Auflösung in `pages/**`/`templates/**`/`lib/Support/**` nur via `app(Foo::class)`
|
||||
- [ ] Keine `new ...Factory()` in `lib/Service/**` außerhalb `*Factory.php`
|
||||
- [ ] Keine direkten `new ...Service()`, `new ...Gateway()`, `new ...Repository()` in `lib/Service/**` außerhalb `*Factory.php`
|
||||
@@ -52,6 +55,7 @@ Kurze Definition of Done vor Merge.
|
||||
- [ ] Keine sensiblen Daten in Fehlern/Logs
|
||||
- [ ] Für `pages/**/data().php`: GET-only + Query-Normalisierung (`gridRequireGetRequest`, `gridParseFilters`)
|
||||
- [ ] Für `pages/**/data().php`: Filter über `gridParseFilters(...)` statt Inline-Parsing
|
||||
- [ ] Für `pages/api/v1/**`: kein `ApiResponse::readJsonBody(...)`, Input nur über `requestInput()`
|
||||
- [ ] Bei MultiSelect-Filtern: CSV-Query (`foo=a,b`) + serverseitige `IN`-Filter mit Limit
|
||||
- [ ] Keine Listen-Alias-Keys (`*_id` neben `*_ids`) neu einführen
|
||||
- [ ] Input nur über `requestInput()` und Validation über `FormErrors` (`/docs/request-input-validation.md`)
|
||||
|
||||
@@ -33,7 +33,18 @@ Empfohlenes Muster:
|
||||
|
||||
Template für neue Komponenten:
|
||||
|
||||
- `/web/js/components/_template.js`
|
||||
- bestehende Komponenten als Referenz verwenden (`/web/js/components/*.js`)
|
||||
|
||||
## Page Module Contract (Hard Cut)
|
||||
|
||||
Für seitenbezogene Initialisierung gilt verbindlich:
|
||||
|
||||
- Kein inline `<script type="module">` in `pages/**` oder `templates/**`.
|
||||
- Pro Seite genau ein externes Modul unter `web/js/pages/*` laden.
|
||||
- Serverseitige Daten für dieses Modul über
|
||||
`<script type="application/json" id="page-config-...">...</script>` bereitstellen.
|
||||
- Page-Module lesen Config zentral über `readPageConfig(...)` aus `web/js/core/app-page-config.js`.
|
||||
- JS-`src` in `pages/**` und `templates/**` nur über `assetVersion('...js...')`.
|
||||
|
||||
## Defensive DOM-Nutzung
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace MintyPHP\Repository\Access;
|
||||
use MintyPHP\DB;
|
||||
use MintyPHP\Repository\Support\RepoQuery;
|
||||
|
||||
class PermissionRepository
|
||||
class PermissionRepository implements PermissionRepositoryInterface
|
||||
{
|
||||
public function list(): array
|
||||
{
|
||||
|
||||
22
lib/Repository/Access/PermissionRepositoryInterface.php
Normal file
22
lib/Repository/Access/PermissionRepositoryInterface.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\Access;
|
||||
|
||||
interface PermissionRepositoryInterface
|
||||
{
|
||||
public function list(): array;
|
||||
|
||||
public function listActive(): array;
|
||||
|
||||
public function listPaged(array $options): array;
|
||||
|
||||
public function find(int $id): ?array;
|
||||
|
||||
public function findByKey(string $key): ?array;
|
||||
|
||||
public function create(array $data): ?int;
|
||||
|
||||
public function update(int $id, array $data): bool;
|
||||
|
||||
public function delete(int $id): bool;
|
||||
}
|
||||
@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\Access;
|
||||
|
||||
use MintyPHP\DB;
|
||||
|
||||
class RolePermissionRepository
|
||||
class RolePermissionRepository implements RolePermissionRepositoryInterface
|
||||
{
|
||||
public function listPermissionIdsByRoleId(int $roleId): array
|
||||
{
|
||||
|
||||
20
lib/Repository/Access/RolePermissionRepositoryInterface.php
Normal file
20
lib/Repository/Access/RolePermissionRepositoryInterface.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\Access;
|
||||
|
||||
interface RolePermissionRepositoryInterface
|
||||
{
|
||||
public function listPermissionIdsByRoleId(int $roleId): array;
|
||||
|
||||
public function countPermissionsByRoleIds(array $roleIds): array;
|
||||
|
||||
public function replaceForRole(int $roleId, array $permissionIds): bool;
|
||||
|
||||
public function listRoleIdsByPermissionId(int $permissionId): array;
|
||||
|
||||
public function replaceForPermission(int $permissionId, array $roleIds): bool;
|
||||
|
||||
public function listPermissionKeysByRoleIds(array $roleIds): array;
|
||||
|
||||
public function listPermissionsWithRolesByRoleIds(array $roleIds): array;
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace MintyPHP\Repository\Access;
|
||||
use MintyPHP\DB;
|
||||
use MintyPHP\Repository\Support\RepoQuery;
|
||||
|
||||
class RoleRepository
|
||||
class RoleRepository implements RoleRepositoryInterface
|
||||
{
|
||||
private function unwrap(?array $row): ?array
|
||||
{
|
||||
@@ -159,7 +159,7 @@ class RoleRepository
|
||||
return $count ? ((int) $count > 0) : false;
|
||||
}
|
||||
|
||||
public function create(array $data)
|
||||
public function create(array $data): mixed
|
||||
{
|
||||
return DB::insert(
|
||||
'insert into roles (uuid, description, code, active, created_by, created) values (?,?,?,?,?,NOW())',
|
||||
|
||||
30
lib/Repository/Access/RoleRepositoryInterface.php
Normal file
30
lib/Repository/Access/RoleRepositoryInterface.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\Access;
|
||||
|
||||
interface RoleRepositoryInterface
|
||||
{
|
||||
public function list(): array;
|
||||
|
||||
public function listActive(): array;
|
||||
|
||||
public function listByIds(array $roleIds): array;
|
||||
|
||||
public function listIds(): array;
|
||||
|
||||
public function listActiveIds(): array;
|
||||
|
||||
public function listPaged(array $options): array;
|
||||
|
||||
public function find(int $id): ?array;
|
||||
|
||||
public function findByUuid(string $uuid): ?array;
|
||||
|
||||
public function existsByCode(string $code, int $excludeId = 0): bool;
|
||||
|
||||
public function create(array $data): mixed;
|
||||
|
||||
public function update(int $id, array $data): bool;
|
||||
|
||||
public function delete(int $id): bool;
|
||||
}
|
||||
@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\Access;
|
||||
|
||||
use MintyPHP\DB;
|
||||
|
||||
class UserRoleRepository
|
||||
class UserRoleRepository implements UserRoleRepositoryInterface
|
||||
{
|
||||
public function listRoleIdsByUserId(int $userId): array
|
||||
{
|
||||
|
||||
16
lib/Repository/Access/UserRoleRepositoryInterface.php
Normal file
16
lib/Repository/Access/UserRoleRepositoryInterface.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\Access;
|
||||
|
||||
interface UserRoleRepositoryInterface
|
||||
{
|
||||
public function listRoleIdsByUserId(int $userId): array;
|
||||
|
||||
public function replaceForUser(int $userId, array $roleIds): bool;
|
||||
|
||||
public function listUserIdsByRoleIds(array $roleIds): array;
|
||||
|
||||
public function countUsersByRoleIds(array $roleIds): array;
|
||||
|
||||
public function countActiveUsersByRoleIds(array $roleIds): array;
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace MintyPHP\Repository\Audit;
|
||||
use MintyPHP\DB;
|
||||
use MintyPHP\Repository\Support\RepoQuery;
|
||||
|
||||
class ApiAuditLogRepository
|
||||
class ApiAuditLogRepository implements ApiAuditLogRepositoryInterface
|
||||
{
|
||||
private const FILTER_OPTIONS_LIMIT_MAX = 200;
|
||||
|
||||
|
||||
16
lib/Repository/Audit/ApiAuditLogRepositoryInterface.php
Normal file
16
lib/Repository/Audit/ApiAuditLogRepositoryInterface.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\Audit;
|
||||
|
||||
interface ApiAuditLogRepositoryInterface
|
||||
{
|
||||
public function create(array $data): int|false;
|
||||
|
||||
public function listPaged(array $filters): array;
|
||||
|
||||
public function listFilterOptions(int $limit = 200): array;
|
||||
|
||||
public function find(int $id): ?array;
|
||||
|
||||
public function purgeOlderThanDays(int $days): int;
|
||||
}
|
||||
@@ -6,7 +6,7 @@ use MintyPHP\Domain\Taxonomy\ImportAuditStatus;
|
||||
use MintyPHP\DB;
|
||||
use MintyPHP\Repository\Support\RepoQuery;
|
||||
|
||||
class ImportAuditRunRepository
|
||||
class ImportAuditRunRepository implements ImportAuditRunRepositoryInterface
|
||||
{
|
||||
private const FILTER_OPTIONS_LIMIT_MAX = 200;
|
||||
|
||||
|
||||
18
lib/Repository/Audit/ImportAuditRunRepositoryInterface.php
Normal file
18
lib/Repository/Audit/ImportAuditRunRepositoryInterface.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\Audit;
|
||||
|
||||
interface ImportAuditRunRepositoryInterface
|
||||
{
|
||||
public function createRunning(array $data): int|false;
|
||||
|
||||
public function finishById(int $id, array $data): bool;
|
||||
|
||||
public function listPaged(array $filters): array;
|
||||
|
||||
public function listFilterOptions(int $limit = 200): array;
|
||||
|
||||
public function find(int $id): ?array;
|
||||
|
||||
public function purgeOlderThanDays(int $days): int;
|
||||
}
|
||||
@@ -7,7 +7,7 @@ use MintyPHP\Domain\Taxonomy\SystemAuditOutcome;
|
||||
use MintyPHP\DB;
|
||||
use MintyPHP\Repository\Support\RepoQuery;
|
||||
|
||||
class SystemAuditLogRepository
|
||||
class SystemAuditLogRepository implements SystemAuditLogRepositoryInterface
|
||||
{
|
||||
private const FILTER_OPTIONS_LIMIT_MAX = 200;
|
||||
|
||||
|
||||
16
lib/Repository/Audit/SystemAuditLogRepositoryInterface.php
Normal file
16
lib/Repository/Audit/SystemAuditLogRepositoryInterface.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\Audit;
|
||||
|
||||
interface SystemAuditLogRepositoryInterface
|
||||
{
|
||||
public function create(array $data): int|false;
|
||||
|
||||
public function listPaged(array $filters): array;
|
||||
|
||||
public function listFilterOptions(int $limit = 200): array;
|
||||
|
||||
public function find(int $id): ?array;
|
||||
|
||||
public function purgeOlderThanDays(int $days): int;
|
||||
}
|
||||
@@ -8,7 +8,7 @@ use MintyPHP\Domain\Taxonomy\UserLifecycleTriggerType;
|
||||
use MintyPHP\DB;
|
||||
use MintyPHP\Repository\Support\RepoQuery;
|
||||
|
||||
class UserLifecycleAuditRepository
|
||||
class UserLifecycleAuditRepository implements UserLifecycleAuditRepositoryInterface
|
||||
{
|
||||
private const FILTER_OPTIONS_LIMIT_MAX = 200;
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\Audit;
|
||||
|
||||
interface UserLifecycleAuditRepositoryInterface
|
||||
{
|
||||
public function create(array $row): int|false;
|
||||
|
||||
public function updateStatus(int $id, string $status, ?string $reasonCode = null): bool;
|
||||
|
||||
public function listPaged(array $filters): array;
|
||||
|
||||
public function listFilterOptions(int $limit = 200): array;
|
||||
|
||||
public function find(int $id): ?array;
|
||||
|
||||
public function findDeleteEventForRestore(int $id, bool $forUpdate = false): ?array;
|
||||
|
||||
public function markRestored(int $id, int $restoredBy, int $restoredUserId): bool;
|
||||
|
||||
public function purgeOlderThanDays(int $days): int;
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace MintyPHP\Repository\Auth;
|
||||
use MintyPHP\DB;
|
||||
use MintyPHP\Repository\Support\RepoQuery;
|
||||
|
||||
class ApiTokenRepository
|
||||
class ApiTokenRepository implements ApiTokenRepositoryInterface
|
||||
{
|
||||
private const UUID_REGEX = '/^[a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/i';
|
||||
|
||||
|
||||
44
lib/Repository/Auth/ApiTokenRepositoryInterface.php
Normal file
44
lib/Repository/Auth/ApiTokenRepositoryInterface.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\Auth;
|
||||
|
||||
interface ApiTokenRepositoryInterface
|
||||
{
|
||||
public function isUuid(string $value): bool;
|
||||
|
||||
public function create(
|
||||
int $userId,
|
||||
string $name,
|
||||
string $selector,
|
||||
string $tokenHash,
|
||||
?int $tenantId,
|
||||
?string $expiresAt,
|
||||
?int $createdBy
|
||||
): ?int;
|
||||
|
||||
public function findBySelector(string $selector): ?array;
|
||||
|
||||
public function find(int $id): ?array;
|
||||
|
||||
public function findByUuid(string $uuid): ?array;
|
||||
|
||||
public function findByUuidForUser(string $uuid, int $userId): ?array;
|
||||
|
||||
public function updateLastUsed(int $id, string $ip): bool;
|
||||
|
||||
public function revoke(int $id): bool;
|
||||
|
||||
public function revokeByUuidForUser(string $uuid, int $userId): bool;
|
||||
|
||||
public function revokeAllForUser(int $userId, ?int $tenantId = null): int;
|
||||
|
||||
public function revokeAllActiveByAdmin(): int;
|
||||
|
||||
public function listByUserId(int $userId, int $limit = 25): array;
|
||||
|
||||
public function countActiveForUser(int $userId): int;
|
||||
|
||||
public function countActiveForUserExcludingId(int $userId, int $excludeId): int;
|
||||
|
||||
public function countActive(): int;
|
||||
}
|
||||
@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\Auth;
|
||||
|
||||
use MintyPHP\DB;
|
||||
|
||||
class EmailVerificationRepository
|
||||
class EmailVerificationRepository implements EmailVerificationRepositoryInterface
|
||||
{
|
||||
public function create(int $userId, string $codeHash, string $expiresAt): ?int
|
||||
{
|
||||
|
||||
18
lib/Repository/Auth/EmailVerificationRepositoryInterface.php
Normal file
18
lib/Repository/Auth/EmailVerificationRepositoryInterface.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\Auth;
|
||||
|
||||
interface EmailVerificationRepositoryInterface
|
||||
{
|
||||
public function create(int $userId, string $codeHash, string $expiresAt): ?int;
|
||||
|
||||
public function invalidateForUser(int $userId): bool;
|
||||
|
||||
public function findActiveByUserId(int $userId): ?array;
|
||||
|
||||
public function findById(int $id): ?array;
|
||||
|
||||
public function incrementAttempts(int $id): bool;
|
||||
|
||||
public function markUsed(int $id): bool;
|
||||
}
|
||||
@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\Auth;
|
||||
|
||||
use MintyPHP\DB;
|
||||
|
||||
class PasswordResetRepository
|
||||
class PasswordResetRepository implements PasswordResetRepositoryInterface
|
||||
{
|
||||
private function unwrapList($rows): array
|
||||
{
|
||||
|
||||
20
lib/Repository/Auth/PasswordResetRepositoryInterface.php
Normal file
20
lib/Repository/Auth/PasswordResetRepositoryInterface.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\Auth;
|
||||
|
||||
interface PasswordResetRepositoryInterface
|
||||
{
|
||||
public function create(int $userId, string $codeHash, string $expiresAt): ?int;
|
||||
|
||||
public function invalidateForUser(int $userId): bool;
|
||||
|
||||
public function findActiveByUserId(int $userId): ?array;
|
||||
|
||||
public function findById(int $id): ?array;
|
||||
|
||||
public function incrementAttempts(int $id): bool;
|
||||
|
||||
public function markUsed(int $id): bool;
|
||||
|
||||
public function listByUserId(int $userId, int $limit = 20): array;
|
||||
}
|
||||
@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\Auth;
|
||||
|
||||
use MintyPHP\DB;
|
||||
|
||||
class RememberTokenRepository
|
||||
class RememberTokenRepository implements RememberTokenRepositoryInterface
|
||||
{
|
||||
private function unwrapList($rows): array
|
||||
{
|
||||
|
||||
22
lib/Repository/Auth/RememberTokenRepositoryInterface.php
Normal file
22
lib/Repository/Auth/RememberTokenRepositoryInterface.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\Auth;
|
||||
|
||||
interface RememberTokenRepositoryInterface
|
||||
{
|
||||
public function create(int $userId, string $selector, string $tokenHash, string $expiresAt): ?int;
|
||||
|
||||
public function findBySelector(string $selector): ?array;
|
||||
|
||||
public function updateToken(int $id, string $tokenHash, string $expiresAt): bool;
|
||||
|
||||
public function expireAllByAdmin(): int;
|
||||
|
||||
public function deleteById(int $id): bool;
|
||||
|
||||
public function deleteByUserId(int $userId): bool;
|
||||
|
||||
public function listByUserId(int $userId, int $limit = 20): array;
|
||||
|
||||
public function countActive(): int;
|
||||
}
|
||||
@@ -6,7 +6,7 @@ use MintyPHP\Domain\Taxonomy\MailLogStatus;
|
||||
use MintyPHP\DB;
|
||||
use MintyPHP\Repository\Support\RepoQuery;
|
||||
|
||||
class MailLogRepository
|
||||
class MailLogRepository implements MailLogRepositoryInterface
|
||||
{
|
||||
public function create(array $data): ?int
|
||||
{
|
||||
|
||||
16
lib/Repository/Mail/MailLogRepositoryInterface.php
Normal file
16
lib/Repository/Mail/MailLogRepositoryInterface.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\Mail;
|
||||
|
||||
interface MailLogRepositoryInterface
|
||||
{
|
||||
public function create(array $data): ?int;
|
||||
|
||||
public function markSent(int $id, ?string $providerMessageId = null): bool;
|
||||
|
||||
public function markFailed(int $id, string $errorMessage): bool;
|
||||
|
||||
public function listPaged(array $options): array;
|
||||
|
||||
public function find(int $id): ?array;
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace MintyPHP\Repository\Org;
|
||||
use MintyPHP\DB;
|
||||
use MintyPHP\Repository\Support\RepoQuery;
|
||||
|
||||
class DepartmentRepository
|
||||
class DepartmentRepository implements DepartmentRepositoryInterface
|
||||
{
|
||||
private function unwrap(?array $row): ?array
|
||||
{
|
||||
@@ -284,7 +284,7 @@ class DepartmentRepository
|
||||
return $count ? (int) $count : 0;
|
||||
}
|
||||
|
||||
public function create(array $data)
|
||||
public function create(array $data): mixed
|
||||
{
|
||||
return DB::insert(
|
||||
'insert into departments (uuid, description, tenant_id, code, cost_center, active, created_by, created) values (?,?,?,?,?,?,?,NOW())',
|
||||
|
||||
36
lib/Repository/Org/DepartmentRepositoryInterface.php
Normal file
36
lib/Repository/Org/DepartmentRepositoryInterface.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\Org;
|
||||
|
||||
interface DepartmentRepositoryInterface
|
||||
{
|
||||
public function list(): array;
|
||||
|
||||
public function listIds(): array;
|
||||
|
||||
public function listActiveIdsByTenantIds(array $tenantIds): array;
|
||||
|
||||
public function listByTenantIds(array $tenantIds): array;
|
||||
|
||||
public function listByIds(array $departmentIds, bool $includeInactive = false): array;
|
||||
|
||||
public function listPaged(array $options): array;
|
||||
|
||||
public function find(int $id): ?array;
|
||||
|
||||
public function findByUuid(string $uuid): ?array;
|
||||
|
||||
public function existsByCode(string $code, int $excludeId = 0): bool;
|
||||
|
||||
public function existsByTenantAndDescription(int $tenantId, string $description, int $excludeId = 0): bool;
|
||||
|
||||
public function countByTenantId(int $tenantId): int;
|
||||
|
||||
public function create(array $data): mixed;
|
||||
|
||||
public function update(int $id, array $data): bool;
|
||||
|
||||
public function setTenant(int $id, int $tenantId): bool;
|
||||
|
||||
public function delete(int $id): bool;
|
||||
}
|
||||
@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\Org;
|
||||
|
||||
use MintyPHP\DB;
|
||||
|
||||
class UserDepartmentRepository
|
||||
class UserDepartmentRepository implements UserDepartmentRepositoryInterface
|
||||
{
|
||||
public function listDepartmentIdsByUserId(int $userId): array
|
||||
{
|
||||
|
||||
16
lib/Repository/Org/UserDepartmentRepositoryInterface.php
Normal file
16
lib/Repository/Org/UserDepartmentRepositoryInterface.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\Org;
|
||||
|
||||
interface UserDepartmentRepositoryInterface
|
||||
{
|
||||
public function listDepartmentIdsByUserId(int $userId): array;
|
||||
|
||||
public function replaceForUser(int $userId, array $departmentIds): bool;
|
||||
|
||||
public function removeInvalidForDepartment(int $departmentId): int;
|
||||
|
||||
public function countUsersByDepartmentIds(array $departmentIds): array;
|
||||
|
||||
public function countActiveUsersByDepartmentIds(array $departmentIds): array;
|
||||
}
|
||||
@@ -6,7 +6,7 @@ use MintyPHP\Domain\Taxonomy\ScheduledJobStatus;
|
||||
use MintyPHP\DB;
|
||||
use MintyPHP\Repository\Support\RepoQuery;
|
||||
|
||||
class ScheduledJobRepository
|
||||
class ScheduledJobRepository implements ScheduledJobRepositoryInterface
|
||||
{
|
||||
public function create(array $data): int|false
|
||||
{
|
||||
|
||||
30
lib/Repository/Scheduler/ScheduledJobRepositoryInterface.php
Normal file
30
lib/Repository/Scheduler/ScheduledJobRepositoryInterface.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\Scheduler;
|
||||
|
||||
interface ScheduledJobRepositoryInterface
|
||||
{
|
||||
public function create(array $data): int|false;
|
||||
|
||||
public function find(int $id): ?array;
|
||||
|
||||
public function findByKey(string $jobKey): ?array;
|
||||
|
||||
public function listPaged(array $filters): array;
|
||||
|
||||
public function listDueJobs(string $nowUtc, int $limit = 20): array;
|
||||
|
||||
public function updateJobMeta(int $id, array $data): bool;
|
||||
|
||||
public function markRunning(int $id, string $startedAtUtc): bool;
|
||||
|
||||
public function finishRun(
|
||||
int $id,
|
||||
string $status,
|
||||
string $startedAtUtc,
|
||||
string $finishedAtUtc,
|
||||
?string $nextRunAtUtc,
|
||||
?string $errorCode,
|
||||
?string $errorMessage
|
||||
): bool;
|
||||
}
|
||||
@@ -7,7 +7,7 @@ use MintyPHP\Domain\Taxonomy\ScheduledJobTriggerType;
|
||||
use MintyPHP\DB;
|
||||
use MintyPHP\Repository\Support\RepoQuery;
|
||||
|
||||
class ScheduledJobRunRepository
|
||||
class ScheduledJobRunRepository implements ScheduledJobRunRepositoryInterface
|
||||
{
|
||||
public function create(array $data): int|false
|
||||
{
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\Scheduler;
|
||||
|
||||
interface ScheduledJobRunRepositoryInterface
|
||||
{
|
||||
public function create(array $data): int|false;
|
||||
|
||||
public function listPagedByJobId(int $jobId, array $filters): array;
|
||||
|
||||
public function purgeOlderThanDays(int $days): int;
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace MintyPHP\Repository\Scheduler;
|
||||
use MintyPHP\Domain\Taxonomy\SchedulerRuntimeResult;
|
||||
use MintyPHP\DB;
|
||||
|
||||
class SchedulerRuntimeRepository
|
||||
class SchedulerRuntimeRepository implements SchedulerRuntimeRepositoryInterface
|
||||
{
|
||||
public function touchHeartbeat(string $result, ?string $errorCode = null, ?string $heartbeatAtUtc = null): bool
|
||||
{
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\Scheduler;
|
||||
|
||||
interface SchedulerRuntimeRepositoryInterface
|
||||
{
|
||||
public function touchHeartbeat(string $result, ?string $errorCode = null, ?string $heartbeatAtUtc = null): bool;
|
||||
|
||||
public function findStatus(): ?array;
|
||||
}
|
||||
@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\Search;
|
||||
|
||||
use MintyPHP\DB;
|
||||
|
||||
class SearchQueryRepository
|
||||
class SearchQueryRepository implements SearchQueryRepositoryInterface
|
||||
{
|
||||
/**
|
||||
* @param array<int, mixed> $params
|
||||
|
||||
17
lib/Repository/Search/SearchQueryRepositoryInterface.php
Normal file
17
lib/Repository/Search/SearchQueryRepositoryInterface.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\Search;
|
||||
|
||||
interface SearchQueryRepositoryInterface
|
||||
{
|
||||
/**
|
||||
* @param array<int, mixed> $params
|
||||
* @return array<int, mixed>
|
||||
*/
|
||||
public function selectRows(string $sql, array $params = []): array;
|
||||
|
||||
/**
|
||||
* @param array<int, mixed> $params
|
||||
*/
|
||||
public function selectCount(string $sql, array $params = []): int;
|
||||
}
|
||||
@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\Security;
|
||||
|
||||
use MintyPHP\DB;
|
||||
|
||||
class RateLimitRepository
|
||||
class RateLimitRepository implements RateLimitRepositoryInterface
|
||||
{
|
||||
public function findByScopeAndHash(string $scope, string $subjectHash): ?array
|
||||
{
|
||||
|
||||
25
lib/Repository/Security/RateLimitRepositoryInterface.php
Normal file
25
lib/Repository/Security/RateLimitRepositoryInterface.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\Security;
|
||||
|
||||
interface RateLimitRepositoryInterface
|
||||
{
|
||||
public function findByScopeAndHash(string $scope, string $subjectHash): ?array;
|
||||
|
||||
public function create(
|
||||
string $scope,
|
||||
string $subjectHash,
|
||||
int $hits,
|
||||
string $windowStartedAt,
|
||||
?string $blockedUntil
|
||||
): bool;
|
||||
|
||||
public function updateStateById(
|
||||
int $id,
|
||||
int $hits,
|
||||
string $windowStartedAt,
|
||||
?string $blockedUntil
|
||||
): bool;
|
||||
|
||||
public function deleteByScopeAndHash(string $scope, string $subjectHash): bool;
|
||||
}
|
||||
@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\Settings;
|
||||
|
||||
use MintyPHP\DB;
|
||||
|
||||
class SettingRepository
|
||||
class SettingRepository implements SettingRepositoryInterface
|
||||
{
|
||||
public function find(string $key): ?array
|
||||
{
|
||||
|
||||
12
lib/Repository/Settings/SettingRepositoryInterface.php
Normal file
12
lib/Repository/Settings/SettingRepositoryInterface.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\Settings;
|
||||
|
||||
interface SettingRepositoryInterface
|
||||
{
|
||||
public function find(string $key): ?array;
|
||||
|
||||
public function getValue(string $key): ?string;
|
||||
|
||||
public function set(string $key, ?string $value, ?string $description = null): bool;
|
||||
}
|
||||
@@ -12,7 +12,7 @@ use MintyPHP\Domain\Taxonomy\UserLifecycleAction;
|
||||
use MintyPHP\Domain\Taxonomy\UserLifecycleStatus;
|
||||
use MintyPHP\DB;
|
||||
|
||||
class AdminStatsRepository
|
||||
class AdminStatsRepository implements AdminStatsRepositoryInterface
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
|
||||
11
lib/Repository/Stats/AdminStatsRepositoryInterface.php
Normal file
11
lib/Repository/Stats/AdminStatsRepositoryInterface.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\Stats;
|
||||
|
||||
interface AdminStatsRepositoryInterface
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function buildViewData(): array;
|
||||
}
|
||||
@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\Support;
|
||||
|
||||
use MintyPHP\DB;
|
||||
|
||||
class DatabaseSessionRepository
|
||||
class DatabaseSessionRepository implements DatabaseSessionRepositoryInterface
|
||||
{
|
||||
public function acquireAdvisoryLock(string $lockName, int $timeoutSeconds = 0): bool
|
||||
{
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\Support;
|
||||
|
||||
interface DatabaseSessionRepositoryInterface
|
||||
{
|
||||
public function acquireAdvisoryLock(string $lockName, int $timeoutSeconds = 0): bool;
|
||||
|
||||
public function releaseAdvisoryLock(string $lockName): void;
|
||||
|
||||
public function beginTransaction(): void;
|
||||
|
||||
public function commitTransaction(): void;
|
||||
|
||||
public function rollbackTransaction(): void;
|
||||
}
|
||||
@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\Tenant;
|
||||
|
||||
use MintyPHP\DB;
|
||||
|
||||
class TenantMicrosoftAuthRepository
|
||||
class TenantMicrosoftAuthRepository implements TenantMicrosoftAuthRepositoryInterface
|
||||
{
|
||||
private function unwrap($row): ?array
|
||||
{
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\Tenant;
|
||||
|
||||
interface TenantMicrosoftAuthRepositoryInterface
|
||||
{
|
||||
public function findByTenantId(int $tenantId): ?array;
|
||||
|
||||
public function listByTenantIds(array $tenantIds): array;
|
||||
|
||||
public function upsertByTenantId(int $tenantId, array $data): bool;
|
||||
}
|
||||
@@ -6,7 +6,7 @@ use MintyPHP\Domain\Taxonomy\TenantStatus;
|
||||
use MintyPHP\DB;
|
||||
use MintyPHP\Repository\Support\RepoQuery;
|
||||
|
||||
class TenantRepository
|
||||
class TenantRepository implements TenantRepositoryInterface
|
||||
{
|
||||
private function unwrap(?array $row): ?array
|
||||
{
|
||||
@@ -168,7 +168,7 @@ class TenantRepository
|
||||
return $this->unwrap($row);
|
||||
}
|
||||
|
||||
public function create(array $data)
|
||||
public function create(array $data): mixed
|
||||
{
|
||||
return DB::insert(
|
||||
'insert into tenants (uuid, description, address, postal_code, city, country, region, vat_id, tax_number, phone, fax, email, support_email, support_phone, billing_email, website, privacy_url, imprint_url, primary_color, default_theme, allow_user_theme, status, status_changed_at, status_changed_by, created_by, created) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,NOW())',
|
||||
|
||||
26
lib/Repository/Tenant/TenantRepositoryInterface.php
Normal file
26
lib/Repository/Tenant/TenantRepositoryInterface.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\Tenant;
|
||||
|
||||
interface TenantRepositoryInterface
|
||||
{
|
||||
public function list(): array;
|
||||
|
||||
public function listIds(): array;
|
||||
|
||||
public function listByIds(array $tenantIds): array;
|
||||
|
||||
public function listActiveIdsByIds(array $tenantIds): array;
|
||||
|
||||
public function listPaged(array $options): array;
|
||||
|
||||
public function find(int $id): ?array;
|
||||
|
||||
public function findByUuid(string $uuid): ?array;
|
||||
|
||||
public function create(array $data): mixed;
|
||||
|
||||
public function update(int $id, array $data): bool;
|
||||
|
||||
public function delete(int $id): bool;
|
||||
}
|
||||
@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\Tenant;
|
||||
|
||||
use MintyPHP\DB;
|
||||
|
||||
class UserTenantRepository
|
||||
class UserTenantRepository implements UserTenantRepositoryInterface
|
||||
{
|
||||
public function listTenantIdsByUserId(int $userId): array
|
||||
{
|
||||
|
||||
14
lib/Repository/Tenant/UserTenantRepositoryInterface.php
Normal file
14
lib/Repository/Tenant/UserTenantRepositoryInterface.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\Tenant;
|
||||
|
||||
interface UserTenantRepositoryInterface
|
||||
{
|
||||
public function listTenantIdsByUserId(int $userId): array;
|
||||
|
||||
public function replaceForUser(int $userId, array $tenantIds): bool;
|
||||
|
||||
public function countUsersByTenantIds(array $tenantIds): array;
|
||||
|
||||
public function countActiveUsersByTenantIds(array $tenantIds): array;
|
||||
}
|
||||
@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\User;
|
||||
|
||||
use MintyPHP\DB;
|
||||
|
||||
class UserExternalIdentityRepository
|
||||
class UserExternalIdentityRepository implements UserExternalIdentityRepositoryInterface
|
||||
{
|
||||
private function unwrap($row): ?array
|
||||
{
|
||||
@@ -39,7 +39,7 @@ class UserExternalIdentityRepository
|
||||
return $this->unwrap($row);
|
||||
}
|
||||
|
||||
public function createLink(array $data)
|
||||
public function createLink(array $data): mixed
|
||||
{
|
||||
return DB::insert(
|
||||
'insert into user_external_identities (user_id, provider, oid, tid, issuer, subject, email_at_link_time, created) values (?,?,?,?,?,?,?,NOW())',
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\User;
|
||||
|
||||
interface UserExternalIdentityRepositoryInterface
|
||||
{
|
||||
public function findByProviderTidOid(string $provider, string $tid, string $oid): ?array;
|
||||
|
||||
public function findByProviderIssuerSubject(string $provider, string $issuer, string $subject): ?array;
|
||||
|
||||
public function createLink(array $data): mixed;
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace MintyPHP\Repository\User;
|
||||
use MintyPHP\DB;
|
||||
use MintyPHP\Repository\Support\RepoQuery;
|
||||
|
||||
class UserListQueryRepository
|
||||
class UserListQueryRepository implements UserListQueryRepositoryInterface
|
||||
{
|
||||
private function buildUserFilters(array $options): array
|
||||
{
|
||||
|
||||
8
lib/Repository/User/UserListQueryRepositoryInterface.php
Normal file
8
lib/Repository/User/UserListQueryRepositoryInterface.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\User;
|
||||
|
||||
interface UserListQueryRepositoryInterface
|
||||
{
|
||||
public function listPaged(array $options): array;
|
||||
}
|
||||
@@ -4,7 +4,7 @@ namespace MintyPHP\Repository\User;
|
||||
|
||||
use MintyPHP\DB;
|
||||
|
||||
class UserReadRepository
|
||||
class UserReadRepository implements UserReadRepositoryInterface
|
||||
{
|
||||
public function findAuthzSnapshot(int $userId): ?array
|
||||
{
|
||||
|
||||
20
lib/Repository/User/UserReadRepositoryInterface.php
Normal file
20
lib/Repository/User/UserReadRepositoryInterface.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\User;
|
||||
|
||||
interface UserReadRepositoryInterface
|
||||
{
|
||||
public function findAuthzSnapshot(int $userId): ?array;
|
||||
|
||||
public function find(int $id): ?array;
|
||||
|
||||
public function findByUuid(string $uuid): ?array;
|
||||
|
||||
public function findByEmail(string $email): ?array;
|
||||
|
||||
public function listPrivilegedUserIdsByPermissionKeys(array $permissionKeys): array;
|
||||
|
||||
public function listIdsForAutoDeactivate(int $days, array $excludedUserIds, int $limit = 500): array;
|
||||
|
||||
public function listIdsForAutoDelete(int $days, array $excludedUserIds, int $limit = 500): array;
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace MintyPHP\Repository\User;
|
||||
use MintyPHP\DB;
|
||||
use MintyPHP\Repository\Support\RepoQuery;
|
||||
|
||||
class UserSavedFilterRepository
|
||||
class UserSavedFilterRepository implements UserSavedFilterRepositoryInterface
|
||||
{
|
||||
private function unwrapList($rows): array
|
||||
{
|
||||
|
||||
14
lib/Repository/User/UserSavedFilterRepositoryInterface.php
Normal file
14
lib/Repository/User/UserSavedFilterRepositoryInterface.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\User;
|
||||
|
||||
interface UserSavedFilterRepositoryInterface
|
||||
{
|
||||
public function listByUserAndContext(int $userId, string $context): array;
|
||||
|
||||
public function countByUserAndContext(int $userId, string $context): int;
|
||||
|
||||
public function create(array $data): int|false;
|
||||
|
||||
public function deleteByUuidForUserAndContext(string $uuid, int $userId, string $context): bool;
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace MintyPHP\Repository\User;
|
||||
use MintyPHP\DB;
|
||||
use MintyPHP\Repository\Support\RepoQuery;
|
||||
|
||||
class UserWriteRepository
|
||||
class UserWriteRepository implements UserWriteRepositoryInterface
|
||||
{
|
||||
public function updateLastLogin(int $userId, string $provider = 'local'): void
|
||||
{
|
||||
|
||||
40
lib/Repository/User/UserWriteRepositoryInterface.php
Normal file
40
lib/Repository/User/UserWriteRepositoryInterface.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Repository\User;
|
||||
|
||||
interface UserWriteRepositoryInterface
|
||||
{
|
||||
public function updateLastLogin(int $userId, string $provider = 'local'): void;
|
||||
|
||||
public function bumpAuthzVersion(int $userId): bool;
|
||||
|
||||
public function bumpAuthzVersionByUserIds(array $userIds): int;
|
||||
|
||||
public function create(array $data): int|false;
|
||||
|
||||
public function update(int $id, array $data): bool;
|
||||
|
||||
public function setActive(int $id, bool $active, ?int $changedBy = null): bool;
|
||||
|
||||
public function setCurrentTenant(int $id, int $tenantId): bool;
|
||||
|
||||
public function setActiveByUuids(array $uuids, bool $active, ?int $modifiedBy = null): bool;
|
||||
|
||||
public function setInactiveByIds(array $userIds, ?int $changedBy = null): int;
|
||||
|
||||
public function deleteByIds(array $userIds): int;
|
||||
|
||||
public function setLocale(int $id, string $locale): bool;
|
||||
|
||||
public function setTheme(int $id, string $theme): bool;
|
||||
|
||||
public function updateProfileFieldsFromSso(int $id, array $fields): bool;
|
||||
|
||||
public function setPassword(int $id, string $password): bool;
|
||||
|
||||
public function setEmailVerified(int $id): bool;
|
||||
|
||||
public function delete(int $id): bool;
|
||||
|
||||
public function deleteByUuids(array $uuids): bool;
|
||||
}
|
||||
@@ -3,8 +3,11 @@
|
||||
namespace MintyPHP\Service\Access;
|
||||
|
||||
use MintyPHP\Repository\Access\PermissionRepository;
|
||||
use MintyPHP\Repository\Access\PermissionRepositoryInterface;
|
||||
use MintyPHP\Repository\Access\RolePermissionRepository;
|
||||
use MintyPHP\Repository\Access\RolePermissionRepositoryInterface;
|
||||
use MintyPHP\Repository\Access\UserRoleRepository;
|
||||
use MintyPHP\Repository\Access\UserRoleRepositoryInterface;
|
||||
|
||||
class AccessRepositoryFactory
|
||||
{
|
||||
@@ -12,17 +15,17 @@ class AccessRepositoryFactory
|
||||
private ?RolePermissionRepository $rolePermissionRepository = null;
|
||||
private ?UserRoleRepository $userRoleRepository = null;
|
||||
|
||||
public function createPermissionRepository(): PermissionRepository
|
||||
public function createPermissionRepository(): PermissionRepositoryInterface
|
||||
{
|
||||
return $this->permissionRepository ??= new PermissionRepository();
|
||||
}
|
||||
|
||||
public function createRolePermissionRepository(): RolePermissionRepository
|
||||
public function createRolePermissionRepository(): RolePermissionRepositoryInterface
|
||||
{
|
||||
return $this->rolePermissionRepository ??= new RolePermissionRepository();
|
||||
}
|
||||
|
||||
public function createUserRoleRepository(): UserRoleRepository
|
||||
public function createUserRoleRepository(): UserRoleRepositoryInterface
|
||||
{
|
||||
return $this->userRoleRepository ??= new UserRoleRepository();
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace MintyPHP\Service\Access;
|
||||
|
||||
use MintyPHP\Repository\Access\PermissionRepository;
|
||||
use MintyPHP\Repository\Access\RolePermissionRepository;
|
||||
use MintyPHP\Repository\Access\UserRoleRepository;
|
||||
use MintyPHP\Repository\Access\PermissionRepositoryInterface;
|
||||
use MintyPHP\Repository\Access\RolePermissionRepositoryInterface;
|
||||
use MintyPHP\Repository\Access\UserRoleRepositoryInterface;
|
||||
|
||||
class AccessServicesFactory
|
||||
{
|
||||
@@ -19,17 +19,17 @@ class AccessServicesFactory
|
||||
$this->accessPolicyFactoryResolver = \Closure::fromCallable($accessPolicyFactoryResolver);
|
||||
}
|
||||
|
||||
public function createPermissionRepository(): PermissionRepository
|
||||
public function createPermissionRepository(): PermissionRepositoryInterface
|
||||
{
|
||||
return $this->accessRepositoryFactory->createPermissionRepository();
|
||||
}
|
||||
|
||||
public function createRolePermissionRepository(): RolePermissionRepository
|
||||
public function createRolePermissionRepository(): RolePermissionRepositoryInterface
|
||||
{
|
||||
return $this->accessRepositoryFactory->createRolePermissionRepository();
|
||||
}
|
||||
|
||||
public function createUserRoleRepository(): UserRoleRepository
|
||||
public function createUserRoleRepository(): UserRoleRepositoryInterface
|
||||
{
|
||||
return $this->accessRepositoryFactory->createUserRoleRepository();
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace MintyPHP\Service\Access;
|
||||
|
||||
use MintyPHP\Repository\Access\PermissionRepository;
|
||||
use MintyPHP\Repository\Access\RolePermissionRepository;
|
||||
use MintyPHP\Repository\Access\UserRoleRepository;
|
||||
use MintyPHP\Repository\Access\PermissionRepositoryInterface;
|
||||
use MintyPHP\Repository\Access\RolePermissionRepositoryInterface;
|
||||
use MintyPHP\Repository\Access\UserRoleRepositoryInterface;
|
||||
use MintyPHP\Service\Audit\SystemAuditService;
|
||||
|
||||
class PermissionService
|
||||
@@ -12,9 +12,9 @@ class PermissionService
|
||||
private array $apiPermissionCache = [];
|
||||
|
||||
public function __construct(
|
||||
private readonly PermissionRepository $permissionRepository,
|
||||
private readonly RolePermissionRepository $rolePermissionRepository,
|
||||
private readonly UserRoleRepository $userRoleRepository,
|
||||
private readonly PermissionRepositoryInterface $permissionRepository,
|
||||
private readonly RolePermissionRepositoryInterface $rolePermissionRepository,
|
||||
private readonly UserRoleRepositoryInterface $userRoleRepository,
|
||||
private readonly SystemAuditService $systemAuditService
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
|
||||
namespace MintyPHP\Service\Access;
|
||||
|
||||
use MintyPHP\Repository\Access\RoleRepository;
|
||||
use MintyPHP\Repository\Access\RoleRepositoryInterface;
|
||||
use MintyPHP\Service\Audit\SystemAuditService;
|
||||
use MintyPHP\Service\Directory\DirectorySettingsGateway;
|
||||
|
||||
class RoleService
|
||||
{
|
||||
public function __construct(
|
||||
private readonly RoleRepository $roleRepository,
|
||||
private readonly RoleRepositoryInterface $roleRepository,
|
||||
private readonly DirectorySettingsGateway $settingsGateway,
|
||||
private readonly SystemAuditService $systemAuditService
|
||||
) {
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace MintyPHP\Service\Audit;
|
||||
|
||||
use MintyPHP\Http\ApiAuth;
|
||||
use MintyPHP\Http\RequestContext;
|
||||
use MintyPHP\Repository\Audit\ApiAuditLogRepository;
|
||||
use MintyPHP\Repository\Audit\ApiAuditLogRepositoryInterface;
|
||||
|
||||
class ApiAuditService
|
||||
{
|
||||
@@ -15,7 +15,7 @@ class ApiAuditService
|
||||
|
||||
private ?array $context = null;
|
||||
|
||||
public function __construct(private readonly ApiAuditLogRepository $apiAuditLogRepository)
|
||||
public function __construct(private readonly ApiAuditLogRepositoryInterface $apiAuditLogRepository)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,11 @@
|
||||
namespace MintyPHP\Service\Audit;
|
||||
|
||||
use MintyPHP\Repository\Audit\ApiAuditLogRepository;
|
||||
use MintyPHP\Repository\Audit\ApiAuditLogRepositoryInterface;
|
||||
use MintyPHP\Repository\Audit\SystemAuditLogRepository;
|
||||
use MintyPHP\Repository\Audit\SystemAuditLogRepositoryInterface;
|
||||
use MintyPHP\Repository\Audit\UserLifecycleAuditRepository;
|
||||
use MintyPHP\Repository\Audit\UserLifecycleAuditRepositoryInterface;
|
||||
|
||||
class AuditRepositoryFactory
|
||||
{
|
||||
@@ -12,17 +15,17 @@ class AuditRepositoryFactory
|
||||
private ?UserLifecycleAuditRepository $userLifecycleAuditRepository = null;
|
||||
private ?SystemAuditLogRepository $systemAuditLogRepository = null;
|
||||
|
||||
public function createApiAuditLogRepository(): ApiAuditLogRepository
|
||||
public function createApiAuditLogRepository(): ApiAuditLogRepositoryInterface
|
||||
{
|
||||
return $this->apiAuditLogRepository ??= new ApiAuditLogRepository();
|
||||
}
|
||||
|
||||
public function createUserLifecycleAuditRepository(): UserLifecycleAuditRepository
|
||||
public function createUserLifecycleAuditRepository(): UserLifecycleAuditRepositoryInterface
|
||||
{
|
||||
return $this->userLifecycleAuditRepository ??= new UserLifecycleAuditRepository();
|
||||
}
|
||||
|
||||
public function createSystemAuditLogRepository(): SystemAuditLogRepository
|
||||
public function createSystemAuditLogRepository(): SystemAuditLogRepositoryInterface
|
||||
{
|
||||
return $this->systemAuditLogRepository ??= new SystemAuditLogRepository();
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace MintyPHP\Service\Audit;
|
||||
|
||||
use MintyPHP\Repository\Audit\ApiAuditLogRepository;
|
||||
use MintyPHP\Repository\Audit\SystemAuditLogRepository;
|
||||
use MintyPHP\Repository\Audit\UserLifecycleAuditRepository;
|
||||
use MintyPHP\Repository\Audit\ApiAuditLogRepositoryInterface;
|
||||
use MintyPHP\Repository\Audit\SystemAuditLogRepositoryInterface;
|
||||
use MintyPHP\Repository\Audit\UserLifecycleAuditRepositoryInterface;
|
||||
use MintyPHP\Service\Settings\SettingGateway;
|
||||
|
||||
class AuditServicesFactory
|
||||
@@ -19,17 +19,17 @@ class AuditServicesFactory
|
||||
private readonly SettingGateway $settingGateway
|
||||
) {}
|
||||
|
||||
public function createApiAuditLogRepository(): ApiAuditLogRepository
|
||||
public function createApiAuditLogRepository(): ApiAuditLogRepositoryInterface
|
||||
{
|
||||
return $this->auditRepositoryFactory->createApiAuditLogRepository();
|
||||
}
|
||||
|
||||
public function createUserLifecycleAuditRepository(): UserLifecycleAuditRepository
|
||||
public function createUserLifecycleAuditRepository(): UserLifecycleAuditRepositoryInterface
|
||||
{
|
||||
return $this->auditRepositoryFactory->createUserLifecycleAuditRepository();
|
||||
}
|
||||
|
||||
public function createSystemAuditLogRepository(): SystemAuditLogRepository
|
||||
public function createSystemAuditLogRepository(): SystemAuditLogRepositoryInterface
|
||||
{
|
||||
return $this->auditRepositoryFactory->createSystemAuditLogRepository();
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace MintyPHP\Service\Audit;
|
||||
|
||||
use MintyPHP\Domain\Taxonomy\ImportAuditStatus;
|
||||
use MintyPHP\Repository\Audit\ImportAuditRunRepository;
|
||||
use MintyPHP\Repository\Audit\ImportAuditRunRepositoryInterface;
|
||||
use MintyPHP\Repository\Support\RepoQuery;
|
||||
|
||||
class ImportAuditService
|
||||
@@ -15,7 +15,7 @@ class ImportAuditService
|
||||
*/
|
||||
private array $startedAtByRunId = [];
|
||||
|
||||
public function __construct(private readonly ImportAuditRunRepository $importAuditRunRepository)
|
||||
public function __construct(private readonly ImportAuditRunRepositoryInterface $importAuditRunRepository)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ use MintyPHP\Domain\Taxonomy\SystemAuditChannel;
|
||||
use MintyPHP\Domain\Taxonomy\SystemAuditOutcome;
|
||||
use MintyPHP\Http\RequestContext;
|
||||
use MintyPHP\Http\ApiAuth;
|
||||
use MintyPHP\Repository\Audit\SystemAuditLogRepository;
|
||||
use MintyPHP\Repository\Audit\SystemAuditLogRepositoryInterface;
|
||||
use MintyPHP\Repository\Support\RepoQuery;
|
||||
use MintyPHP\Service\Settings\SettingGateway;
|
||||
|
||||
@@ -17,7 +17,7 @@ class SystemAuditService
|
||||
private const RETENTION_DAYS_FALLBACK = 365;
|
||||
|
||||
public function __construct(
|
||||
private readonly SystemAuditLogRepository $systemAuditLogRepository,
|
||||
private readonly SystemAuditLogRepositoryInterface $systemAuditLogRepository,
|
||||
private readonly SystemAuditRedactionService $systemAuditRedactionService,
|
||||
private readonly SettingGateway $settingGateway
|
||||
) {
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace MintyPHP\Service\Audit;
|
||||
use MintyPHP\Domain\Taxonomy\UserLifecycleAction;
|
||||
use MintyPHP\Domain\Taxonomy\UserLifecycleStatus;
|
||||
use MintyPHP\Domain\Taxonomy\UserLifecycleTriggerType;
|
||||
use MintyPHP\Repository\Audit\UserLifecycleAuditRepository;
|
||||
use MintyPHP\Repository\Audit\UserLifecycleAuditRepositoryInterface;
|
||||
use MintyPHP\Support\Crypto;
|
||||
|
||||
class UserLifecycleAuditService
|
||||
@@ -42,7 +42,7 @@ class UserLifecycleAuditService
|
||||
'active_changed_at',
|
||||
];
|
||||
|
||||
public function __construct(private readonly UserLifecycleAuditRepository $userLifecycleAuditRepository)
|
||||
public function __construct(private readonly UserLifecycleAuditRepositoryInterface $userLifecycleAuditRepository)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -2,17 +2,17 @@
|
||||
|
||||
namespace MintyPHP\Service\Auth;
|
||||
|
||||
use MintyPHP\Repository\Auth\ApiTokenRepository;
|
||||
use MintyPHP\Repository\Auth\ApiTokenRepositoryInterface;
|
||||
use MintyPHP\Repository\Support\DatabaseSessionRepository;
|
||||
use MintyPHP\Repository\User\UserReadRepository;
|
||||
use MintyPHP\Repository\User\UserReadRepositoryInterface;
|
||||
|
||||
class ApiTokenService
|
||||
{
|
||||
private const MAX_TOKENS_PER_USER = 10;
|
||||
|
||||
public function __construct(
|
||||
private readonly UserReadRepository $userReadRepository,
|
||||
private readonly ApiTokenRepository $apiTokenRepository,
|
||||
private readonly UserReadRepositoryInterface $userReadRepository,
|
||||
private readonly ApiTokenRepositoryInterface $apiTokenRepository,
|
||||
private readonly AuthSettingsGateway $settingsGateway,
|
||||
private readonly AuthScopeGateway $scopeGateway,
|
||||
private readonly DatabaseSessionRepository $databaseSessionRepository
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
namespace MintyPHP\Service\Auth;
|
||||
|
||||
use MintyPHP\Repository\User\UserExternalIdentityRepository;
|
||||
use MintyPHP\Repository\User\UserExternalIdentityRepositoryInterface;
|
||||
|
||||
class AuthExternalIdentityGateway
|
||||
{
|
||||
public function __construct(private readonly UserExternalIdentityRepository $userExternalIdentityRepository)
|
||||
public function __construct(private readonly UserExternalIdentityRepositoryInterface $userExternalIdentityRepository)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,19 @@
|
||||
namespace MintyPHP\Service\Auth;
|
||||
|
||||
use MintyPHP\Repository\Auth\ApiTokenRepository;
|
||||
use MintyPHP\Repository\Auth\ApiTokenRepositoryInterface;
|
||||
use MintyPHP\Repository\Auth\EmailVerificationRepository;
|
||||
use MintyPHP\Repository\Auth\EmailVerificationRepositoryInterface;
|
||||
use MintyPHP\Repository\Auth\PasswordResetRepository;
|
||||
use MintyPHP\Repository\Auth\PasswordResetRepositoryInterface;
|
||||
use MintyPHP\Repository\Auth\RememberTokenRepository;
|
||||
use MintyPHP\Repository\Auth\RememberTokenRepositoryInterface;
|
||||
use MintyPHP\Repository\Tenant\TenantMicrosoftAuthRepository;
|
||||
use MintyPHP\Repository\Tenant\TenantMicrosoftAuthRepositoryInterface;
|
||||
use MintyPHP\Repository\Tenant\TenantRepository;
|
||||
use MintyPHP\Repository\Tenant\TenantRepositoryInterface;
|
||||
use MintyPHP\Repository\User\UserExternalIdentityRepository;
|
||||
use MintyPHP\Repository\User\UserExternalIdentityRepositoryInterface;
|
||||
|
||||
class AuthRepositoryFactory
|
||||
{
|
||||
@@ -20,37 +27,37 @@ class AuthRepositoryFactory
|
||||
private ?TenantMicrosoftAuthRepository $tenantMicrosoftAuthRepository = null;
|
||||
private ?UserExternalIdentityRepository $userExternalIdentityRepository = null;
|
||||
|
||||
public function createApiTokenRepository(): ApiTokenRepository
|
||||
public function createApiTokenRepository(): ApiTokenRepositoryInterface
|
||||
{
|
||||
return $this->apiTokenRepository ??= new ApiTokenRepository();
|
||||
}
|
||||
|
||||
public function createRememberTokenRepository(): RememberTokenRepository
|
||||
public function createRememberTokenRepository(): RememberTokenRepositoryInterface
|
||||
{
|
||||
return $this->rememberTokenRepository ??= new RememberTokenRepository();
|
||||
}
|
||||
|
||||
public function createPasswordResetRepository(): PasswordResetRepository
|
||||
public function createPasswordResetRepository(): PasswordResetRepositoryInterface
|
||||
{
|
||||
return $this->passwordResetRepository ??= new PasswordResetRepository();
|
||||
}
|
||||
|
||||
public function createEmailVerificationRepository(): EmailVerificationRepository
|
||||
public function createEmailVerificationRepository(): EmailVerificationRepositoryInterface
|
||||
{
|
||||
return $this->emailVerificationRepository ??= new EmailVerificationRepository();
|
||||
}
|
||||
|
||||
public function createTenantRepository(): TenantRepository
|
||||
public function createTenantRepository(): TenantRepositoryInterface
|
||||
{
|
||||
return $this->tenantRepository ??= new TenantRepository();
|
||||
}
|
||||
|
||||
public function createTenantMicrosoftAuthRepository(): TenantMicrosoftAuthRepository
|
||||
public function createTenantMicrosoftAuthRepository(): TenantMicrosoftAuthRepositoryInterface
|
||||
{
|
||||
return $this->tenantMicrosoftAuthRepository ??= new TenantMicrosoftAuthRepository();
|
||||
}
|
||||
|
||||
public function createUserExternalIdentityRepository(): UserExternalIdentityRepository
|
||||
public function createUserExternalIdentityRepository(): UserExternalIdentityRepositoryInterface
|
||||
{
|
||||
return $this->userExternalIdentityRepository ??= new UserExternalIdentityRepository();
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
namespace MintyPHP\Service\Auth;
|
||||
|
||||
use MintyPHP\Auth;
|
||||
use MintyPHP\Repository\User\UserReadRepository;
|
||||
use MintyPHP\Repository\User\UserWriteRepository;
|
||||
use MintyPHP\Repository\User\UserReadRepositoryInterface;
|
||||
use MintyPHP\Repository\User\UserWriteRepositoryInterface;
|
||||
use MintyPHP\Router;
|
||||
use MintyPHP\Service\User\UserAccountService;
|
||||
use MintyPHP\Service\User\UserTenantContextService;
|
||||
@@ -15,8 +15,8 @@ use MintyPHP\Support\Flash;
|
||||
class AuthService
|
||||
{
|
||||
public function __construct(
|
||||
private readonly UserReadRepository $userReadRepository,
|
||||
private readonly UserWriteRepository $userWriteRepository,
|
||||
private readonly UserReadRepositoryInterface $userReadRepository,
|
||||
private readonly UserWriteRepositoryInterface $userWriteRepository,
|
||||
private readonly UserAccountService $userAccountService,
|
||||
private readonly UserTenantContextService $userTenantContextService,
|
||||
private readonly RememberMeService $rememberMeService,
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
namespace MintyPHP\Service\Auth;
|
||||
|
||||
use MintyPHP\Repository\Tenant\TenantRepository;
|
||||
use MintyPHP\Repository\Tenant\TenantRepositoryInterface;
|
||||
|
||||
class AuthTenantGateway
|
||||
{
|
||||
public function __construct(private readonly TenantRepository $tenantRepository)
|
||||
public function __construct(private readonly TenantRepositoryInterface $tenantRepository)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ namespace MintyPHP\Service\Auth;
|
||||
|
||||
use MintyPHP\Http\Request;
|
||||
use MintyPHP\I18n;
|
||||
use MintyPHP\Repository\Auth\EmailVerificationRepository;
|
||||
use MintyPHP\Repository\User\UserReadRepository;
|
||||
use MintyPHP\Repository\User\UserWriteRepository;
|
||||
use MintyPHP\Repository\Auth\EmailVerificationRepositoryInterface;
|
||||
use MintyPHP\Repository\User\UserReadRepositoryInterface;
|
||||
use MintyPHP\Repository\User\UserWriteRepositoryInterface;
|
||||
use MintyPHP\Service\Mail\MailService;
|
||||
|
||||
class EmailVerificationService
|
||||
@@ -16,9 +16,9 @@ class EmailVerificationService
|
||||
private const MAX_ATTEMPTS = 5;
|
||||
|
||||
public function __construct(
|
||||
private readonly UserReadRepository $userReadRepository,
|
||||
private readonly UserWriteRepository $userWriteRepository,
|
||||
private readonly EmailVerificationRepository $emailVerificationRepository,
|
||||
private readonly UserReadRepositoryInterface $userReadRepository,
|
||||
private readonly UserWriteRepositoryInterface $userWriteRepository,
|
||||
private readonly EmailVerificationRepositoryInterface $emailVerificationRepository,
|
||||
private readonly MailService $mailService
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ namespace MintyPHP\Service\Auth;
|
||||
|
||||
use MintyPHP\Http\Request;
|
||||
use MintyPHP\I18n;
|
||||
use MintyPHP\Repository\Auth\PasswordResetRepository;
|
||||
use MintyPHP\Repository\User\UserReadRepository;
|
||||
use MintyPHP\Repository\Auth\PasswordResetRepositoryInterface;
|
||||
use MintyPHP\Repository\User\UserReadRepositoryInterface;
|
||||
use MintyPHP\Service\Mail\MailService;
|
||||
use MintyPHP\Service\User\UserPasswordService;
|
||||
|
||||
@@ -16,8 +16,8 @@ class PasswordResetService
|
||||
private const MAX_ATTEMPTS = 5;
|
||||
|
||||
public function __construct(
|
||||
private readonly UserReadRepository $userReadRepository,
|
||||
private readonly PasswordResetRepository $passwordResetRepository,
|
||||
private readonly UserReadRepositoryInterface $userReadRepository,
|
||||
private readonly PasswordResetRepositoryInterface $passwordResetRepository,
|
||||
private readonly UserPasswordService $userPasswordService,
|
||||
private readonly RememberMeService $rememberMeService,
|
||||
private readonly MailService $mailService
|
||||
|
||||
@@ -4,9 +4,9 @@ namespace MintyPHP\Service\Auth;
|
||||
|
||||
use MintyPHP\Auth;
|
||||
use MintyPHP\I18n;
|
||||
use MintyPHP\Repository\Auth\RememberTokenRepository;
|
||||
use MintyPHP\Repository\User\UserReadRepository;
|
||||
use MintyPHP\Repository\User\UserWriteRepository;
|
||||
use MintyPHP\Repository\Auth\RememberTokenRepositoryInterface;
|
||||
use MintyPHP\Repository\User\UserReadRepositoryInterface;
|
||||
use MintyPHP\Repository\User\UserWriteRepositoryInterface;
|
||||
use MintyPHP\Service\User\UserTenantContextService;
|
||||
use MintyPHP\Session;
|
||||
|
||||
@@ -16,9 +16,9 @@ class RememberMeService
|
||||
private const LIFETIME_DAYS = 30;
|
||||
|
||||
public function __construct(
|
||||
private readonly UserReadRepository $userReadRepository,
|
||||
private readonly UserWriteRepository $userWriteRepository,
|
||||
private readonly RememberTokenRepository $rememberTokenRepository,
|
||||
private readonly UserReadRepositoryInterface $userReadRepository,
|
||||
private readonly UserWriteRepositoryInterface $userWriteRepository,
|
||||
private readonly RememberTokenRepositoryInterface $rememberTokenRepository,
|
||||
private readonly UserTenantContextService $userTenantContextService,
|
||||
private readonly AuthPermissionGateway $permissionGateway,
|
||||
private readonly AuthSavedFilterGateway $savedFilterGateway
|
||||
|
||||
@@ -2,19 +2,19 @@
|
||||
|
||||
namespace MintyPHP\Service\Auth;
|
||||
|
||||
use MintyPHP\Repository\Tenant\UserTenantRepository;
|
||||
use MintyPHP\Repository\User\UserReadRepository;
|
||||
use MintyPHP\Repository\User\UserWriteRepository;
|
||||
use MintyPHP\Repository\Tenant\UserTenantRepositoryInterface;
|
||||
use MintyPHP\Repository\User\UserReadRepositoryInterface;
|
||||
use MintyPHP\Repository\User\UserWriteRepositoryInterface;
|
||||
use MintyPHP\Service\User\UserAssignmentService;
|
||||
use MintyPHP\Service\User\UserAvatarService;
|
||||
|
||||
class SsoUserLinkService
|
||||
{
|
||||
public function __construct(
|
||||
private readonly UserReadRepository $userReadRepository,
|
||||
private readonly UserWriteRepository $userWriteRepository,
|
||||
private readonly UserReadRepositoryInterface $userReadRepository,
|
||||
private readonly UserWriteRepositoryInterface $userWriteRepository,
|
||||
private readonly UserAssignmentService $userAssignmentService,
|
||||
private readonly UserTenantRepository $userTenantRepository,
|
||||
private readonly UserTenantRepositoryInterface $userTenantRepository,
|
||||
private readonly AuthSettingsGateway $settingsGateway,
|
||||
private readonly AuthTenantSsoGateway $tenantSsoGateway,
|
||||
private readonly AuthAvatarGateway $avatarGateway,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace MintyPHP\Service\Auth;
|
||||
|
||||
use MintyPHP\Repository\Tenant\TenantMicrosoftAuthRepository;
|
||||
use MintyPHP\Repository\Tenant\TenantMicrosoftAuthRepositoryInterface;
|
||||
|
||||
class TenantSsoService
|
||||
{
|
||||
@@ -20,7 +20,7 @@ class TenantSsoService
|
||||
|
||||
public function __construct(
|
||||
private readonly AuthTenantGateway $tenantGateway,
|
||||
private readonly TenantMicrosoftAuthRepository $tenantMicrosoftAuthRepository,
|
||||
private readonly TenantMicrosoftAuthRepositoryInterface $tenantMicrosoftAuthRepository,
|
||||
private readonly AuthSettingsGateway $settingsGateway,
|
||||
private readonly AuthCryptoGateway $cryptoGateway
|
||||
) {
|
||||
|
||||
@@ -3,8 +3,11 @@
|
||||
namespace MintyPHP\Service\Directory;
|
||||
|
||||
use MintyPHP\Repository\Access\RoleRepository;
|
||||
use MintyPHP\Repository\Access\RoleRepositoryInterface;
|
||||
use MintyPHP\Repository\Org\DepartmentRepository;
|
||||
use MintyPHP\Repository\Org\DepartmentRepositoryInterface;
|
||||
use MintyPHP\Repository\Tenant\TenantRepository;
|
||||
use MintyPHP\Repository\Tenant\TenantRepositoryInterface;
|
||||
|
||||
class DirectoryRepositoryFactory
|
||||
{
|
||||
@@ -12,17 +15,17 @@ class DirectoryRepositoryFactory
|
||||
private ?DepartmentRepository $departmentRepository = null;
|
||||
private ?RoleRepository $roleRepository = null;
|
||||
|
||||
public function createTenantRepository(): TenantRepository
|
||||
public function createTenantRepository(): TenantRepositoryInterface
|
||||
{
|
||||
return $this->tenantRepository ??= new TenantRepository();
|
||||
}
|
||||
|
||||
public function createDepartmentRepository(): DepartmentRepository
|
||||
public function createDepartmentRepository(): DepartmentRepositoryInterface
|
||||
{
|
||||
return $this->departmentRepository ??= new DepartmentRepository();
|
||||
}
|
||||
|
||||
public function createRoleRepository(): RoleRepository
|
||||
public function createRoleRepository(): RoleRepositoryInterface
|
||||
{
|
||||
return $this->roleRepository ??= new RoleRepository();
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace MintyPHP\Service\Directory;
|
||||
|
||||
use MintyPHP\Repository\Access\RoleRepository;
|
||||
use MintyPHP\Repository\Org\DepartmentRepository;
|
||||
use MintyPHP\Repository\Tenant\TenantRepository;
|
||||
use MintyPHP\Repository\Access\RoleRepositoryInterface;
|
||||
use MintyPHP\Repository\Org\DepartmentRepositoryInterface;
|
||||
use MintyPHP\Repository\Tenant\TenantRepositoryInterface;
|
||||
use MintyPHP\Service\Access\RoleService;
|
||||
use MintyPHP\Service\Audit\AuditServicesFactory;
|
||||
use MintyPHP\Service\Org\DepartmentService;
|
||||
@@ -54,17 +54,17 @@ class DirectoryServicesFactory
|
||||
);
|
||||
}
|
||||
|
||||
public function createTenantRepository(): TenantRepository
|
||||
public function createTenantRepository(): TenantRepositoryInterface
|
||||
{
|
||||
return $this->directoryRepositoryFactory->createTenantRepository();
|
||||
}
|
||||
|
||||
public function createDepartmentRepository(): DepartmentRepository
|
||||
public function createDepartmentRepository(): DepartmentRepositoryInterface
|
||||
{
|
||||
return $this->directoryRepositoryFactory->createDepartmentRepository();
|
||||
}
|
||||
|
||||
public function createRoleRepository(): RoleRepository
|
||||
public function createRoleRepository(): RoleRepositoryInterface
|
||||
{
|
||||
return $this->directoryRepositoryFactory->createRoleRepository();
|
||||
}
|
||||
|
||||
@@ -3,12 +3,13 @@
|
||||
namespace MintyPHP\Service\Import;
|
||||
|
||||
use MintyPHP\Repository\Audit\ImportAuditRunRepository;
|
||||
use MintyPHP\Repository\Audit\ImportAuditRunRepositoryInterface;
|
||||
|
||||
class ImportRepositoryFactory
|
||||
{
|
||||
private ?ImportAuditRunRepository $importAuditRunRepository = null;
|
||||
|
||||
public function createImportAuditRunRepository(): ImportAuditRunRepository
|
||||
public function createImportAuditRunRepository(): ImportAuditRunRepositoryInterface
|
||||
{
|
||||
return $this->importAuditRunRepository ??= new ImportAuditRunRepository();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace MintyPHP\Service\Import;
|
||||
|
||||
use MintyPHP\Repository\Audit\ImportAuditRunRepository;
|
||||
use MintyPHP\Repository\Audit\ImportAuditRunRepositoryInterface;
|
||||
use MintyPHP\Service\Access\AccessServicesFactory;
|
||||
use MintyPHP\Service\Access\PermissionGateway;
|
||||
use MintyPHP\Service\Audit\ImportAuditService;
|
||||
@@ -86,7 +86,7 @@ class ImportServicesFactory
|
||||
return $this->importTempFileService ??= new ImportTempFileService();
|
||||
}
|
||||
|
||||
private function getImportAuditRunRepository(): ImportAuditRunRepository
|
||||
private function getImportAuditRunRepository(): ImportAuditRunRepositoryInterface
|
||||
{
|
||||
return $this->importRepositoryFactory->createImportAuditRunRepository();
|
||||
}
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
|
||||
namespace MintyPHP\Service\Import\Profile;
|
||||
|
||||
use MintyPHP\Repository\Org\DepartmentRepository;
|
||||
use MintyPHP\Repository\Tenant\TenantRepository;
|
||||
use MintyPHP\Repository\Org\DepartmentRepositoryInterface;
|
||||
use MintyPHP\Repository\Tenant\TenantRepositoryInterface;
|
||||
use MintyPHP\Service\Org\DepartmentService;
|
||||
|
||||
class DepartmentImportGateway
|
||||
{
|
||||
public function __construct(
|
||||
private readonly DepartmentRepository $departmentRepository,
|
||||
private readonly TenantRepository $tenantRepository,
|
||||
private readonly DepartmentRepositoryInterface $departmentRepository,
|
||||
private readonly TenantRepositoryInterface $tenantRepository,
|
||||
private readonly DepartmentService $departmentService
|
||||
) {
|
||||
}
|
||||
@@ -44,12 +44,12 @@ class DepartmentImportGateway
|
||||
return $this->departmentService()->createFromAdmin($input, $currentUserId);
|
||||
}
|
||||
|
||||
private function departmentRepository(): DepartmentRepository
|
||||
private function departmentRepository(): DepartmentRepositoryInterface
|
||||
{
|
||||
return $this->departmentRepository;
|
||||
}
|
||||
|
||||
private function tenantRepository(): TenantRepository
|
||||
private function tenantRepository(): TenantRepositoryInterface
|
||||
{
|
||||
return $this->tenantRepository;
|
||||
}
|
||||
|
||||
@@ -2,17 +2,17 @@
|
||||
|
||||
namespace MintyPHP\Service\Import\Profile;
|
||||
|
||||
use MintyPHP\Repository\Access\RoleRepository;
|
||||
use MintyPHP\Repository\Org\DepartmentRepository;
|
||||
use MintyPHP\Repository\Tenant\TenantRepository;
|
||||
use MintyPHP\Repository\User\UserReadRepository;
|
||||
use MintyPHP\Repository\Access\RoleRepositoryInterface;
|
||||
use MintyPHP\Repository\Org\DepartmentRepositoryInterface;
|
||||
use MintyPHP\Repository\Tenant\TenantRepositoryInterface;
|
||||
use MintyPHP\Repository\User\UserReadRepositoryInterface;
|
||||
use MintyPHP\Service\User\UserAccountService;
|
||||
use MintyPHP\Service\User\UserRepositoryFactory;
|
||||
|
||||
class UserImportGateway
|
||||
{
|
||||
public function __construct(
|
||||
private readonly UserReadRepository $userReadRepository,
|
||||
private readonly UserReadRepositoryInterface $userReadRepository,
|
||||
private readonly UserAccountService $userAccountService,
|
||||
private readonly UserRepositoryFactory $userRepositoryFactory
|
||||
) {
|
||||
@@ -62,17 +62,17 @@ class UserImportGateway
|
||||
return $this->userAccountService->createFromAdmin($input, $currentUserId);
|
||||
}
|
||||
|
||||
private function tenantRepository(): TenantRepository
|
||||
private function tenantRepository(): TenantRepositoryInterface
|
||||
{
|
||||
return $this->userRepositoryFactory->createTenantRepository();
|
||||
}
|
||||
|
||||
private function roleRepository(): RoleRepository
|
||||
private function roleRepository(): RoleRepositoryInterface
|
||||
{
|
||||
return $this->userRepositoryFactory->createRoleRepository();
|
||||
}
|
||||
|
||||
private function departmentRepository(): DepartmentRepository
|
||||
private function departmentRepository(): DepartmentRepositoryInterface
|
||||
{
|
||||
return $this->userRepositoryFactory->createDepartmentRepository();
|
||||
}
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
namespace MintyPHP\Service\Mail;
|
||||
|
||||
use MintyPHP\Repository\Mail\MailLogRepository;
|
||||
use MintyPHP\Repository\Mail\MailLogRepositoryInterface;
|
||||
|
||||
class MailLogService
|
||||
{
|
||||
public function __construct(private readonly MailLogRepository $mailLogRepository)
|
||||
public function __construct(private readonly MailLogRepositoryInterface $mailLogRepository)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,13 @@
|
||||
namespace MintyPHP\Service\Mail;
|
||||
|
||||
use MintyPHP\Repository\Mail\MailLogRepository;
|
||||
use MintyPHP\Repository\Mail\MailLogRepositoryInterface;
|
||||
|
||||
class MailRepositoryFactory
|
||||
{
|
||||
private ?MailLogRepository $mailLogRepository = null;
|
||||
|
||||
public function createMailLogRepository(): MailLogRepository
|
||||
public function createMailLogRepository(): MailLogRepositoryInterface
|
||||
{
|
||||
return $this->mailLogRepository ??= new MailLogRepository();
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace MintyPHP\Service\Mail;
|
||||
|
||||
use MintyPHP\Domain\Taxonomy\MailLogStatus;
|
||||
use MintyPHP\I18n;
|
||||
use MintyPHP\Repository\Mail\MailLogRepository;
|
||||
use MintyPHP\Repository\Mail\MailLogRepositoryInterface;
|
||||
use MintyPHP\Service\Settings\SettingGateway;
|
||||
use PHPMailer\PHPMailer\Exception as MailerException;
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
@@ -12,7 +12,7 @@ use PHPMailer\PHPMailer\PHPMailer;
|
||||
class MailService
|
||||
{
|
||||
public function __construct(
|
||||
private readonly MailLogRepository $mailLogRepository,
|
||||
private readonly MailLogRepositoryInterface $mailLogRepository,
|
||||
private readonly SettingGateway $settingGateway
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace MintyPHP\Service\Mail;
|
||||
|
||||
use MintyPHP\Repository\Mail\MailLogRepository;
|
||||
use MintyPHP\Repository\Mail\MailLogRepositoryInterface;
|
||||
use MintyPHP\Service\Settings\SettingGateway;
|
||||
|
||||
class MailServicesFactory
|
||||
@@ -15,7 +15,7 @@ class MailServicesFactory
|
||||
private readonly SettingGateway $settingGateway
|
||||
) {}
|
||||
|
||||
public function createMailLogRepository(): MailLogRepository
|
||||
public function createMailLogRepository(): MailLogRepositoryInterface
|
||||
{
|
||||
return $this->mailRepositoryFactory->createMailLogRepository();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace MintyPHP\Service\Org;
|
||||
|
||||
use MintyPHP\Repository\Org\DepartmentRepository;
|
||||
use MintyPHP\Repository\Org\DepartmentRepositoryInterface;
|
||||
use MintyPHP\Service\Audit\SystemAuditService;
|
||||
use MintyPHP\Service\Directory\DirectoryScopeGateway;
|
||||
use MintyPHP\Service\Directory\DirectorySettingsGateway;
|
||||
@@ -12,7 +12,7 @@ class DepartmentService
|
||||
{
|
||||
public function __construct(
|
||||
private readonly UserServicesFactory $userServicesFactory,
|
||||
private readonly DepartmentRepository $departmentRepository,
|
||||
private readonly DepartmentRepositoryInterface $departmentRepository,
|
||||
private readonly DirectorySettingsGateway $settingsGateway,
|
||||
private readonly DirectoryScopeGateway $scopeGateway,
|
||||
private readonly SystemAuditService $systemAuditService
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
|
||||
namespace MintyPHP\Service\Scheduler;
|
||||
|
||||
use MintyPHP\Repository\Scheduler\ScheduledJobRepository;
|
||||
use MintyPHP\Repository\Scheduler\ScheduledJobRunRepository;
|
||||
use MintyPHP\Repository\Scheduler\ScheduledJobRepositoryInterface;
|
||||
use MintyPHP\Repository\Scheduler\ScheduledJobRunRepositoryInterface;
|
||||
|
||||
class ScheduledJobService
|
||||
{
|
||||
private const RUN_RETENTION_DAYS = 90;
|
||||
|
||||
public function __construct(
|
||||
private readonly ScheduledJobRepository $scheduledJobRepository,
|
||||
private readonly ScheduledJobRunRepository $scheduledJobRunRepository,
|
||||
private readonly ScheduledJobRepositoryInterface $scheduledJobRepository,
|
||||
private readonly ScheduledJobRunRepositoryInterface $scheduledJobRunRepository,
|
||||
private readonly ScheduledJobRegistry $scheduledJobRegistry,
|
||||
private readonly ScheduleCalculator $scheduleCalculator
|
||||
) {
|
||||
|
||||
@@ -3,8 +3,11 @@
|
||||
namespace MintyPHP\Service\Scheduler;
|
||||
|
||||
use MintyPHP\Repository\Scheduler\ScheduledJobRepository;
|
||||
use MintyPHP\Repository\Scheduler\ScheduledJobRepositoryInterface;
|
||||
use MintyPHP\Repository\Scheduler\ScheduledJobRunRepository;
|
||||
use MintyPHP\Repository\Scheduler\ScheduledJobRunRepositoryInterface;
|
||||
use MintyPHP\Repository\Scheduler\SchedulerRuntimeRepository;
|
||||
use MintyPHP\Repository\Scheduler\SchedulerRuntimeRepositoryInterface;
|
||||
|
||||
class SchedulerRepositoryFactory
|
||||
{
|
||||
@@ -12,17 +15,17 @@ class SchedulerRepositoryFactory
|
||||
private ?ScheduledJobRunRepository $scheduledJobRunRepository = null;
|
||||
private ?SchedulerRuntimeRepository $schedulerRuntimeRepository = null;
|
||||
|
||||
public function createScheduledJobRepository(): ScheduledJobRepository
|
||||
public function createScheduledJobRepository(): ScheduledJobRepositoryInterface
|
||||
{
|
||||
return $this->scheduledJobRepository ??= new ScheduledJobRepository();
|
||||
}
|
||||
|
||||
public function createScheduledJobRunRepository(): ScheduledJobRunRepository
|
||||
public function createScheduledJobRunRepository(): ScheduledJobRunRepositoryInterface
|
||||
{
|
||||
return $this->scheduledJobRunRepository ??= new ScheduledJobRunRepository();
|
||||
}
|
||||
|
||||
public function createSchedulerRuntimeRepository(): SchedulerRuntimeRepository
|
||||
public function createSchedulerRuntimeRepository(): SchedulerRuntimeRepositoryInterface
|
||||
{
|
||||
return $this->schedulerRuntimeRepository ??= new SchedulerRuntimeRepository();
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@ use MintyPHP\Domain\Taxonomy\ScheduledJobRunStatus;
|
||||
use MintyPHP\Domain\Taxonomy\ScheduledJobTriggerType;
|
||||
use MintyPHP\Domain\Taxonomy\SchedulerRuntimeResult;
|
||||
use MintyPHP\Domain\Taxonomy\SystemAuditOutcome;
|
||||
use MintyPHP\Repository\Scheduler\ScheduledJobRepository;
|
||||
use MintyPHP\Repository\Scheduler\ScheduledJobRunRepository;
|
||||
use MintyPHP\Repository\Scheduler\SchedulerRuntimeRepository;
|
||||
use MintyPHP\Repository\Scheduler\ScheduledJobRepositoryInterface;
|
||||
use MintyPHP\Repository\Scheduler\ScheduledJobRunRepositoryInterface;
|
||||
use MintyPHP\Repository\Scheduler\SchedulerRuntimeRepositoryInterface;
|
||||
use MintyPHP\Repository\Support\DatabaseSessionRepository;
|
||||
use MintyPHP\Repository\Support\RepoQuery;
|
||||
use MintyPHP\Service\Audit\SystemAuditService;
|
||||
@@ -27,9 +27,9 @@ class SchedulerRunService
|
||||
|
||||
public function __construct(
|
||||
private readonly ScheduledJobService $scheduledJobService,
|
||||
private readonly ScheduledJobRepository $scheduledJobRepository,
|
||||
private readonly ScheduledJobRunRepository $scheduledJobRunRepository,
|
||||
private readonly SchedulerRuntimeRepository $schedulerRuntimeRepository,
|
||||
private readonly ScheduledJobRepositoryInterface $scheduledJobRepository,
|
||||
private readonly ScheduledJobRunRepositoryInterface $scheduledJobRunRepository,
|
||||
private readonly SchedulerRuntimeRepositoryInterface $schedulerRuntimeRepository,
|
||||
private readonly ScheduledJobRegistry $scheduledJobRegistry,
|
||||
private readonly ScheduleCalculator $scheduleCalculator,
|
||||
private readonly DatabaseSessionRepository $databaseSessionRepository,
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace MintyPHP\Service\Scheduler;
|
||||
|
||||
use MintyPHP\Repository\Scheduler\ScheduledJobRepository;
|
||||
use MintyPHP\Repository\Scheduler\ScheduledJobRunRepository;
|
||||
use MintyPHP\Repository\Scheduler\SchedulerRuntimeRepository;
|
||||
use MintyPHP\Repository\Scheduler\ScheduledJobRepositoryInterface;
|
||||
use MintyPHP\Repository\Scheduler\ScheduledJobRunRepositoryInterface;
|
||||
use MintyPHP\Repository\Scheduler\SchedulerRuntimeRepositoryInterface;
|
||||
use MintyPHP\Repository\Support\DatabaseSessionRepository;
|
||||
use MintyPHP\Service\Audit\AuditServicesFactory;
|
||||
use MintyPHP\Service\Audit\SystemAuditService;
|
||||
@@ -54,17 +54,17 @@ class SchedulerServicesFactory
|
||||
return $this->getUserLifecycleService();
|
||||
}
|
||||
|
||||
private function getScheduledJobRepository(): ScheduledJobRepository
|
||||
private function getScheduledJobRepository(): ScheduledJobRepositoryInterface
|
||||
{
|
||||
return $this->schedulerRepositoryFactory->createScheduledJobRepository();
|
||||
}
|
||||
|
||||
private function getScheduledJobRunRepository(): ScheduledJobRunRepository
|
||||
private function getScheduledJobRunRepository(): ScheduledJobRunRepositoryInterface
|
||||
{
|
||||
return $this->schedulerRepositoryFactory->createScheduledJobRunRepository();
|
||||
}
|
||||
|
||||
private function getSchedulerRuntimeRepository(): SchedulerRuntimeRepository
|
||||
private function getSchedulerRuntimeRepository(): SchedulerRuntimeRepositoryInterface
|
||||
{
|
||||
return $this->schedulerRepositoryFactory->createSchedulerRuntimeRepository();
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user