mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-02-23 00:22:00 +00:00
- Implemented Rejectuser function to delete a user and send rejection details via SMS. - Added SendUserRejectionDetailSMS function for SMS notifications. - Introduced AddDevice function to create new devices associated with users. - Updated user-actions.ts to include new functionalities and improve user management. - Refactored auth-guard.ts to ensure proper session handling for admin access.
15 lines
340 B
TypeScript
15 lines
340 B
TypeScript
"use server";
|
|
import { auth } from "@/lib/auth";
|
|
import { headers } from "next/headers";
|
|
import { redirect } from "next/navigation";
|
|
|
|
export async function AdminAuthGuard() {
|
|
const session = await auth.api.getSession({
|
|
headers: await headers(),
|
|
});
|
|
if (session?.user.role !== "ADMIN") {
|
|
return redirect("/login");
|
|
}
|
|
return true;
|
|
}
|