mirror of
https://github.com/dyzulk/trustlab.git
synced 2026-01-26 05:25:36 +07:00
fix: allow owner role to access admin pages
This commit is contained in:
@@ -24,12 +24,13 @@ export default function RootCaManagementClient() {
|
||||
const [isRenewing, setIsRenewing] = useState(false);
|
||||
const [confirmRenewUuid, setConfirmRenewUuid] = useState<string | null>(null);
|
||||
|
||||
// Redirect if not admin (double security, backend also checks)
|
||||
// Redirect if not admin or owner (double security, backend also checks)
|
||||
const { isAdminOrOwner } = useAuth();
|
||||
React.useEffect(() => {
|
||||
if (user && user.role !== "admin") {
|
||||
if (user && !isAdminOrOwner) {
|
||||
router.push("/dashboard");
|
||||
}
|
||||
}, [user, router]);
|
||||
}, [user, isAdminOrOwner, router]);
|
||||
|
||||
const handleRenew = async (uuid: string) => {
|
||||
setIsRenewing(true);
|
||||
|
||||
Reference in New Issue
Block a user