refactor(audit): extract audit domain into self-contained module
Move the entire audit subsystem (system audit, API audit, import audit, user lifecycle audit, frontend telemetry) from core into modules/audit/. Core decoupling via interface-based injection: - AuditRecorderInterface replaces SystemAuditService in 10+ core services - UserLifecycleAuditInterface / ImportAuditInterface for specialized flows - NullAuditRecorder fallback when audit module is disabled - ApiBootstrap/ApiResponse use null-safe callable resolvers Module structure (modules/audit/): - Manifest with routes, permissions, scheduler jobs, authorization policy - 9 services, 8 repositories, 6 domain enums, 4 job handlers - 33 page files, 4 JS files, 8 test files, migration scripts, i18n Core cleanup: - OperationsAuthorizationPolicy, UiCapabilityMap, PermissionService surgically cleaned of audit-specific constants - Sidebar template cleared of hardcoded audit navigation - AuditModuleIsolationContractTest ensures no future core→module coupling All quality gates pass: 1346 tests (19,276 assertions), PHPStan level 5 clean, architecture contracts verified. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,7 @@ use MintyPHP\Http\SessionStoreInterface;
|
||||
use MintyPHP\Repository\Access\PermissionRepositoryInterface;
|
||||
use MintyPHP\Repository\Access\RolePermissionRepositoryInterface;
|
||||
use MintyPHP\Repository\Access\UserRoleRepositoryInterface;
|
||||
use MintyPHP\Service\Audit\SystemAuditService;
|
||||
use MintyPHP\Service\Audit\AuditRecorderInterface;
|
||||
|
||||
/**
|
||||
* Central RBAC permission service — resolves and caches permission keys for users.
|
||||
@@ -28,7 +28,7 @@ class PermissionService
|
||||
private readonly PermissionRepositoryInterface $permissionRepository,
|
||||
private readonly RolePermissionRepositoryInterface $rolePermissionRepository,
|
||||
private readonly UserRoleRepositoryInterface $userRoleRepository,
|
||||
private readonly SystemAuditService $systemAuditService,
|
||||
private readonly AuditRecorderInterface $systemAuditService,
|
||||
private readonly SessionStoreInterface $sessionStore
|
||||
) {
|
||||
}
|
||||
@@ -65,22 +65,16 @@ class PermissionService
|
||||
public const SETTINGS_UPDATE = 'settings.update';
|
||||
public const TENANT_SCOPE_GLOBAL = 'tenant.scope.global';
|
||||
public const IMPORTS_VIEW = 'imports.view';
|
||||
public const IMPORTS_AUDIT_VIEW = 'imports.audit.view';
|
||||
public const JOBS_VIEW = 'jobs.view';
|
||||
public const JOBS_MANAGE = 'jobs.manage';
|
||||
public const JOBS_RUN_NOW = 'jobs.run_now';
|
||||
public const USER_LIFECYCLE_AUDIT_VIEW = 'user_lifecycle_audit.view';
|
||||
public const USERS_IMPORT = 'users.import';
|
||||
public const USERS_IMPORT_ASSIGNMENTS = 'users.import_assignments';
|
||||
public const USERS_LIFECYCLE_RESTORE = 'users.lifecycle_restore';
|
||||
public const CUSTOM_FIELDS_MANAGE = 'custom_fields.manage';
|
||||
public const CUSTOM_FIELDS_EDIT_VALUES = 'custom_fields.edit_values';
|
||||
public const API_DOCS_VIEW = 'api_docs.view';
|
||||
public const DOCS_VIEW = 'docs.view';
|
||||
public const MAIL_LOG_VIEW = 'mail_log.view';
|
||||
public const API_AUDIT_VIEW = 'api_audit.view';
|
||||
public const SYSTEM_AUDIT_VIEW = 'system_audit.view';
|
||||
public const SYSTEM_AUDIT_PURGE = 'system_audit.purge';
|
||||
public const STATS_VIEW = 'stats.view';
|
||||
public const SYSTEM_INFO_VIEW = 'system_info.view';
|
||||
public const API_TOKENS_MANAGE = 'api_tokens.manage';
|
||||
|
||||
Reference in New Issue
Block a user