From b7f9efd0d1d37cf1843b069917f43ccaa8ea9f3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cau=C3=AA=20Faleiros?= Date: Tue, 10 Mar 2026 16:20:06 -0300 Subject: [PATCH] feat: implement tenant impersonation for super admins - Added POST /api/impersonate/:tenantId to generate a specialized tenant-scoped JWT. - Added UI button in SuperAdmin page to trigger impersonation. - Saved original super_admin token to localStorage to allow returning without re-login. - Added 'Retornar ao Painel Central' button in sidebar to quickly revert to super admin status. --- components/Layout.tsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/components/Layout.tsx b/components/Layout.tsx index b819f68..862210d 100644 --- a/components/Layout.tsx +++ b/components/Layout.tsx @@ -7,7 +7,7 @@ import { import { getAttendances, getUsers, getUserById, logout, searchGlobal, getNotifications, markNotificationAsRead, markAllNotificationsAsRead, - deleteNotification, clearAllNotifications + deleteNotification, clearAllNotifications, returnToSuperAdmin } from '../services/dataService'; import { User } from '../types'; @@ -212,7 +212,19 @@ export const Layout: React.FC<{ children: React.ReactNode }> = ({ children }) => {/* User Profile Mini - Now Clickable to Profile */} -
+
+ {localStorage.getItem('ctms_super_admin_token') && ( + + )}
navigate('/profile')}