원클릭으로
role-auth-extension
Use when extending user roles or securing pages behind custom roles (e.g. adding VENDOR, MANAGER, etc.).
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Use when extending user roles or securing pages behind custom roles (e.g. adding VENDOR, MANAGER, etc.).
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Use when adding a brand-new CRUD resource beyond the core entity (e.g. a second model the PS requires).
Use when building or restyling any page or component.
Use when constructing forms, inputs, submit behaviors, validation displays, and feedback toast alerts.
Use when creating new Next.js route handlers using the custom helper wrapper.
Use whenever the Prisma schema changes and a migration is needed.
Use when integrating third-party APIs (e.g. SMTP emails, SMS notification gateways, payment checkout gates, or OCR parsers).
| name | role-auth-extension |
| description | Use when extending user roles or securing pages behind custom roles (e.g. adding VENDOR, MANAGER, etc.). |
Follow these steps to add new roles (e.g., VENDOR, MANAGER, DELIVERY) and secure pages or endpoints accordingly:
Update schema.prisma:
prisma/schema.prisma.enum Role to include your new role:
enum Role {
USER
ADMIN
VENDOR // New role
}
npx prisma migrate dev --name add_role_vendor and npx prisma generate.Update Type Definitions:
src/types/next-auth.d.ts and add the new role string to the typescript Union type if it is strictly typed.Secure API Route Handlers:
const session = await auth();
if (session?.user?.role !== "VENDOR") {
return Response.json({ error: "Access denied" }, { status: 403 });
}
createApiRoute:
handler: async (req, { session }) => {
if (session.user.role !== "VENDOR") {
return Response.json({ error: "Forbidden" }, { status: 403 });
}
// ...
}
Secure Frontend Pages:
src/middleware.ts to block unauthorized navigation./dashboard/vendor/*) and checking token.role.