1
0
Fork 0
polaris-task-force/src/collections/game/GameRules.ts
Z8MB1E a3e88ef9fa feat: add mission access control with assignment-based permissions
- Add commandAssignments and intelAssignments to GameRules global
- Implement role-based read access for missions (developer, admin, command, intel)
- Add visibility levels: unit, leadership, intel, private
- Restrict draft missions to authors, zeus, command, and intel
- Change faction field from text to relationship in missions
- Make missionFile optional in game setup
2026-07-31 20:03:35 -04:00

42 lines
1.2 KiB
TypeScript

import { GlobalConfig } from "payload";
import { isDeveloper } from "@/utils/access-control/isRole";
export const GameRules: GlobalConfig = {
slug: "game-rules",
access: {
read: isDeveloper,
update: isDeveloper,
},
fields: [
{
name: "mainCurrency",
type: "relationship",
relationTo: "resources",
required: true,
admin: {
description:
'The base currency ("gold standard") used by all factions to pay for goods and services.',
},
},
{
name: "commandAssignments",
type: "relationship",
relationTo: "assignments",
hasMany: true,
admin: {
description:
"Assignment(s) considered unit command. Members and leaders of these assignments get elevated access to draft missions and other restricted content.",
},
},
{
name: "intelAssignments",
type: "relationship",
relationTo: "assignments",
hasMany: true,
admin: {
description:
"Assignment(s) considered the intelligence division. Members and leaders of these assignments get elevated access to draft missions and intelligence content.",
},
},
],
};