forked from fa/breadcrumb-the-shire
Fix 5 broken FQCN references (runtime errors) where core pages referenced non-existent MintyPHP\Service\Audit\AuditMetadataEnricher and SystemAuditService. Add AuditMetadataEnricherInterface with NullAuditMetadataEnricher fallback so deactivating the audit module no longer crashes core edit pages. Move audit search resources from core Search*Provider files into the module via a new AuditSearchResourceProvider implementing the existing SearchResourceProvider contract. Add module-specific purge permissions (audit.api.purge, audit.imports.purge) replacing core ABILITY_ADMIN_SETTINGS_UPDATE. Also fixes: session key prefix convention, hardcoded English string, $_SERVER superglobal fallback, and manifest schema drift (i18n_path, group in ui_slots). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
62 lines
1.8 KiB
PHP
62 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace MintyPHP\Support\Search;
|
|
|
|
class SearchUiMetaProvider
|
|
{
|
|
private const ICONS = [
|
|
'users' => 'bi-person-badge',
|
|
'tenants' => 'bi-buildings',
|
|
'departments' => 'bi-diagram-3',
|
|
'roles' => 'bi-people',
|
|
'permissions' => 'bi-shield-lock',
|
|
'scheduled-jobs' => 'bi-calendar-check',
|
|
'pages' => 'bi-file-text',
|
|
'mail-log' => 'bi-envelope-paper',
|
|
'docs' => 'bi-journal-text',
|
|
];
|
|
|
|
private const LIST_URL_KEYS = [
|
|
'users',
|
|
'tenants',
|
|
'departments',
|
|
'roles',
|
|
'permissions',
|
|
'scheduled-jobs',
|
|
'pages',
|
|
'mail-log',
|
|
];
|
|
|
|
public static function iconForKey(string $key): string
|
|
{
|
|
return self::ICONS[$key] ?? 'bi-search';
|
|
}
|
|
|
|
public static function listUrl(string $key, string $query): string
|
|
{
|
|
$encoded = urlencode($query);
|
|
|
|
return match ($key) {
|
|
'users' => lurl('admin/users') . '?search=' . $encoded,
|
|
'tenants' => lurl('admin/tenants') . '?search=' . $encoded,
|
|
'departments' => lurl('admin/departments') . '?search=' . $encoded,
|
|
'roles' => lurl('admin/roles') . '?search=' . $encoded,
|
|
'permissions' => lurl('admin/permissions') . '?search=' . $encoded,
|
|
'scheduled-jobs' => lurl('admin/scheduled-jobs') . '?search=' . $encoded,
|
|
'pages' => lurl(''),
|
|
'mail-log' => lurl('admin/mail-log') . '?search=' . $encoded,
|
|
default => lurl(''),
|
|
};
|
|
}
|
|
|
|
public static function hasIconForKey(string $key): bool
|
|
{
|
|
return array_key_exists($key, self::ICONS);
|
|
}
|
|
|
|
public static function hasListUrlForKey(string $key): bool
|
|
{
|
|
return in_array($key, self::LIST_URL_KEYS, true);
|
|
}
|
|
}
|