Initial commit: ANOUMA website with Payload CMS, WebRTC meetings, and booking system
- Next.js 16 App Router site with the ANOUMA design system - Payload CMS (PostgreSQL) for offers, events, posts and page content - WebRTC video-call system with custom signaling server - SMTP email reminders and booking-request notifications - Customer accounts, calendar-based availability, and booking workflow
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import type { Access, FieldAccess } from "payload";
|
||||
|
||||
/**
|
||||
* Only the "users" auth collection (Anna/admins) may perform the action —
|
||||
* and only with the "admin" role, so adding further roles to Users later
|
||||
* only means extending this one check. Site visitors authenticate against
|
||||
* the separate "customers" collection (see collections/Customers.ts) and
|
||||
* must never be treated as admins here.
|
||||
*/
|
||||
export const isAdmin: Access = ({ req: { user } }) =>
|
||||
user?.collection === "users" && user.role === "admin";
|
||||
|
||||
export const isAdminFieldLevel: FieldAccess = ({ req: { user } }) =>
|
||||
user?.collection === "users" && user.role === "admin";
|
||||
|
||||
/**
|
||||
* Admins can read every document (including drafts); everyone else may only
|
||||
* read documents whose Payload draft/publish status is "published".
|
||||
*/
|
||||
export const publishedOrAdmin: Access = ({ req: { user } }) => {
|
||||
if (user?.collection === "users" && user.role === "admin") return true;
|
||||
|
||||
return {
|
||||
_status: { equals: "published" },
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user