feat(api-docs): extract API docs viewer into standalone module
Move the Swagger UI viewer from core (pages/admin/api-docs/) into modules/api-docs/ as a self-contained module. Create module manifest with routes, permission, sidebar.admin_nav_item slot, asset group, and authorization policy. Remove API docs ability from core OperationsAuthorizationPolicy and UiCapabilityMap. Remove hardcoded sidebar nav item — now contributed via module slot. Add admin-automation group meta to sidebar template for module nav items. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -14,7 +14,6 @@ $canViewPermissions = (bool) ($layoutAuth['can_view_permissions'] ?? false);
|
||||
$canViewSettings = (bool) ($layoutAuth['can_view_settings'] ?? false);
|
||||
$canViewImports = (bool) ($layoutAuth['can_view_imports'] ?? false);
|
||||
$canViewJobs = (bool) ($layoutAuth['can_view_jobs'] ?? false);
|
||||
$canViewApiDocs = (bool) ($layoutAuth['can_view_api_docs'] ?? false);
|
||||
$canViewDocs = (bool) ($layoutAuth['can_view_docs'] ?? false);
|
||||
$canViewMailLog = (bool) ($layoutAuth['can_view_mail_log'] ?? false);
|
||||
$canViewStats = (bool) ($layoutAuth['can_view_stats'] ?? false);
|
||||
@@ -23,7 +22,7 @@ $docsDefaultSlug = DocsCatalogService::defaultSlug();
|
||||
$docsDefaultPath = 'admin/docs/' . $docsDefaultSlug;
|
||||
$hasOrganization = $canViewTenants || $canViewDepartments || $canViewUsers;
|
||||
$hasUsersSection = $canViewRoles || $canViewPermissions;
|
||||
$hasAutomationSection = $canViewImports || $canViewJobs || $canViewApiDocs;
|
||||
$hasAutomationSection = $canViewImports || $canViewJobs;
|
||||
$hasMonitoringSection = $canViewStats;
|
||||
$hasLogsSection = $canViewMailLog;
|
||||
$hasSystemSection = $canViewSettings || $canViewSystemInfo || $canViewDocs;
|
||||
@@ -102,13 +101,6 @@ $adminNavGroups = [
|
||||
'visible' => $canViewJobs,
|
||||
'withTenant' => false,
|
||||
],
|
||||
[
|
||||
'label' => t('API docs'),
|
||||
'path' => 'admin/api-docs',
|
||||
'active' => navActive('admin/api-docs', true),
|
||||
'visible' => $canViewApiDocs,
|
||||
'withTenant' => false,
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
@@ -133,7 +125,7 @@ $adminNavGroups = [
|
||||
'visible' => $hasLogsSection,
|
||||
'items' => [
|
||||
[
|
||||
'label' => t('Mail logs'),
|
||||
'label' => t('nav.logs.mail'),
|
||||
'path' => 'admin/mail-log',
|
||||
'active' => navActive('admin/mail-log', true),
|
||||
'visible' => $canViewMailLog,
|
||||
@@ -199,6 +191,7 @@ if ($moduleNavItemSlots) {
|
||||
}
|
||||
// Known group metadata — modules declare their group key, we map to label + icon.
|
||||
$moduleGroupMeta = [
|
||||
'admin-automation' => ['label' => t('Automation & integrations'), 'icon' => 'bi-gear-wide-connected'],
|
||||
'admin-logs' => ['label' => t('Audit & logs'), 'icon' => 'bi-journal-text'],
|
||||
];
|
||||
foreach ($moduleGroupsByKey as $groupKey => $items) {
|
||||
@@ -209,7 +202,7 @@ if ($moduleNavItemSlots) {
|
||||
// Also add mail log to the logs group if it exists as a core item
|
||||
if ($groupKey === 'admin-logs' && $canViewMailLog) {
|
||||
array_unshift($items, [
|
||||
'label' => t('Mail logs'),
|
||||
'label' => t('nav.logs.mail'),
|
||||
'path' => 'admin/mail-log',
|
||||
'active' => navActive('admin/mail-log', true),
|
||||
'visible' => $canViewMailLog,
|
||||
|
||||
Reference in New Issue
Block a user