feat(classes): schema + RLS + permissions (data layer)
Migration 032 adds classes (offering; optional payment_link and grants_certification_id, is_active archive), class_sessions (scheduled occurrence; denormalized space_id) and class_signups (member signup; partial unique = one non-cancelled signup per member+session). RLS is additive and default-deny: classes readable by managers (all) or members (active only), class_sessions by any space member, class_signups by managers/instructors (all) or the member (own) with instructor-only UPDATE and no INSERT/DELETE policy so signup/cancel funnels through a validated service-client action (capacity/waitlist/dedupe). New classes.manage + classes.instruct permissions (group Classes) seeded to board and backfilled. Mirrored idempotently in schema.sql; types and schema docs updated.
This commit is contained in:
@@ -24,6 +24,8 @@ export const PERMISSIONS = [
|
||||
{ code: 'forms.manage', group: 'Community', label: 'Manage forms and waivers' },
|
||||
{ code: 'certifications.manage', group: 'Certifications', label: 'Manage certification types' },
|
||||
{ code: 'certifications.grant', group: 'Certifications', label: 'Award and revoke certifications (Instructor)' },
|
||||
{ code: 'classes.manage', group: 'Classes', label: 'Manage classes and schedule sessions' },
|
||||
{ code: 'classes.instruct', group: 'Classes', label: 'Run classes: attendance, completion, attendees' },
|
||||
{ code: 'customize.manage', group: 'Admin', label: 'Customize roles, tiers, areas, invites, onboarding' },
|
||||
{ code: 'settings.manage', group: 'Admin', label: 'Space settings, integrations, webhooks' },
|
||||
] as const
|
||||
@@ -44,6 +46,7 @@ export const DEFAULT_ROLE_PERMISSIONS: Record<string, PermissionCode[]> = {
|
||||
'members.manage', 'payments.manage', 'governance.manage',
|
||||
'forum.moderate', 'forms.manage',
|
||||
'certifications.manage', 'certifications.grant',
|
||||
'classes.manage', 'classes.instruct',
|
||||
'customize.manage', 'settings.manage',
|
||||
],
|
||||
treasurer: ['payments.manage', 'ops.kb.read', 'ops.process.read'],
|
||||
|
||||
Reference in New Issue
Block a user