67 lines
3.0 KiB
TypeScript
67 lines
3.0 KiB
TypeScript
/**
|
|
* SCREEN-AUTH-002: Role Authorization & Access Denial View.
|
|
*
|
|
* Fulfills FR-AUTH-002 & SCREEN-AUTH-002.md (rebaselined under CR-002).
|
|
* Styled per DESIGN.md: AgriTrade Mercantile (Tactile Corporate Minimalism).
|
|
*/
|
|
import React from 'react';
|
|
import { authStore } from '../../stores/authStore';
|
|
import { Button } from '../../components/ui/Button';
|
|
import { ShieldAlert, ArrowLeft, LogOut } from 'lucide-react';
|
|
|
|
export const AccessDeniedView: React.FC = () => {
|
|
const user = authStore.getState().user;
|
|
|
|
return (
|
|
<div className="min-h-screen flex items-center justify-center bg-surface text-on-surface p-4 font-sans">
|
|
<div className="max-w-lg w-full bg-card-surface border border-card-border rounded p-8 shadow-none text-center">
|
|
<div className="inline-flex items-center justify-center w-12 h-12 rounded bg-error-container text-error mb-4">
|
|
<ShieldAlert className="w-6 h-6" />
|
|
</div>
|
|
|
|
<h1 className="text-xl font-bold tracking-tight text-text-primary mb-1">403 — Authorization Boundary Enforced</h1>
|
|
<p className="text-text-muted text-xs mb-6 font-mono">
|
|
Security policy prevents access to this screen or business action under your active role claims.
|
|
</p>
|
|
|
|
<div className="bg-surface-low rounded p-4 mb-6 text-left border border-card-border space-y-2">
|
|
<div className="text-[10px] uppercase font-semibold text-text-muted font-mono tracking-wider">
|
|
Security Enforcement Context
|
|
</div>
|
|
<div className="text-xs text-text-primary flex justify-between">
|
|
<span className="text-text-muted">Authenticated Identity:</span>
|
|
<span className="font-mono font-medium">{user?.email || 'Anonymous'}</span>
|
|
</div>
|
|
<div className="text-xs text-text-primary flex justify-between">
|
|
<span className="text-text-muted">Assigned Roles:</span>
|
|
<span className="font-mono font-semibold text-accent-ochre">
|
|
{user?.roles?.length ? user.roles.join(', ') : 'None'}
|
|
</span>
|
|
</div>
|
|
<div className="text-[11px] text-text-muted mt-3 pt-3 border-t border-card-border font-mono">
|
|
Mandatory Segregation of Duties (BRD-FR-040): Quality Officers cannot edit prices; Yard Supervisors cannot confirm sales; Sales Executives cannot override credit locks.
|
|
</div>
|
|
</div>
|
|
|
|
<div className="flex space-x-3 justify-center">
|
|
<a href="/">
|
|
<Button variant="primary" size="sm" className="flex items-center space-x-1 font-mono">
|
|
<ArrowLeft className="w-3.5 h-3.5 mr-1" />
|
|
<span>Return to Workspace</span>
|
|
</Button>
|
|
</a>
|
|
<Button
|
|
variant="secondary"
|
|
size="sm"
|
|
onClick={() => authStore.logout()}
|
|
className="flex items-center space-x-1 font-mono"
|
|
>
|
|
<LogOut className="w-3.5 h-3.5 mr-1" />
|
|
<span>Switch Account</span>
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|