feat(c4,arch-006): plugin route renderer enforces manifest permission via protected route

This commit is contained in:
Agent Zero
2026-08-23 22:24:43 +02:00
parent b01b756a4a
commit 067fc132cb
2 changed files with 11 additions and 1 deletions
@@ -2,6 +2,7 @@ import { useMemo } from 'react';
import { useLocation } from 'react-router-dom'; import { useLocation } from 'react-router-dom';
import { Loader2 } from 'lucide-react'; import { Loader2 } from 'lucide-react';
import { usePluginStore } from '@/store/pluginStore'; import { usePluginStore } from '@/store/pluginStore';
import { ProtectedRoute } from '@/components/common/ProtectedRoute';
import { PluginPage } from './PluginLoader'; import { PluginPage } from './PluginLoader';
/** /**
@@ -43,12 +44,20 @@ export function PluginRouteRenderer() {
); );
const pluginName = plugin?.display_name || plugin?.name || matchedRoute.path; const pluginName = plugin?.display_name || plugin?.name || matchedRoute.path;
return ( const page = (
<PluginPage <PluginPage
component={matchedRoute.component} component={matchedRoute.component}
pluginName={pluginName} pluginName={pluginName}
/> />
); );
// ARCH-006: enforce the manifest permission like the static routes do.
// Empty permission = any authenticated user (route is already inside the
// protected route group).
if (matchedRoute.permission) {
return <ProtectedRoute permission={matchedRoute.permission}>{page}</ProtectedRoute>;
}
return page;
} }
// If manifests haven't loaded yet, show a spinner (not null/blank) // If manifests haven't loaded yet, show a spinner (not null/blank)
+1
View File
@@ -17,6 +17,7 @@ export interface PluginPageRoute {
parent: string; parent: string;
protected: boolean; protected: boolean;
order: number; order: number;
permission?: string;
} }
export interface PluginDetailTab { export interface PluginDetailTab {