mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-06-29 21:53:57 +00:00
Add user rejection and device addition functionalities
- 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.
This commit is contained in:
@ -1,11 +1,12 @@
|
||||
"use server";
|
||||
import { auth } from "@/lib/auth";
|
||||
import { redirect } from "next/navigation";
|
||||
import { headers } from "next/headers";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
const session = await auth.api.getSession({
|
||||
headers: await headers(),
|
||||
});
|
||||
export async function AdminAuthGuard() {
|
||||
const session = await auth.api.getSession({
|
||||
headers: await headers(),
|
||||
});
|
||||
if (session?.user.role !== "ADMIN") {
|
||||
return redirect("/login");
|
||||
}
|
||||
|
Reference in New Issue
Block a user