Skip to content

Gate event creation to coordinators (sevak+)#503

Open
KishParikh13 wants to merge 1 commit into
v2from
feat/admins-only-event-creation
Open

Gate event creation to coordinators (sevak+)#503
KishParikh13 wants to merge 1 commit into
v2from
feat/admins-only-event-creation

Conversation

@KishParikh13

Copy link
Copy Markdown
Collaborator

What

Locks event creation to coordinators (verification_level ≥ SEVAK / 54) or global admins. This implements the beta decision: only admins create events; pilot coordinators (San Jose / Dallas) get admin access and invite normal members to their center.

Previously any signed-in user saw the "Create" button — that was temporary beta scaffolding (explore.web.tsx literally said "Beta: any signed-in user can create events… post-beta this becomes a coordinator-tier gate"). This turns the gate on.

Changes

  • Backend POST /addEvent: rejects below-SEVAK callers with 403 (admins still allowed).
  • Frontend: hides the Create entry point on Discover for non-coordinators via isSevakOrAdmin(user) — covers all three entry points:
    • app/(tabs)/explore.tsx (native)
    • app/(tabs)/explore.web.tsx (desktop web)
    • components/explore/MobileDiscoverFallback.web.tsx (mobile web)
  • Tests: promote the event-creating fixtures to SEVAK (they represent coordinators); add a negative test asserting a normal member gets 403.

Notes

  • Edit/delete gates are unchanged (already creator-or-admin on both platforms).
  • Beta coordinators must be provisioned at level 54 in prod D1 (ops task, tracked separately).
  • Part of the round-1 event-admin work; companion PRs: admin attendee roster + CSV export, guest-RSVP open-by-default, invite-link share fix.

Test plan

  • npm run typecheck (backend + frontend) clean
  • npm run test backend — 432 passing (incl. new 403 test)
  • Manual: as a normal member, no Create button on Discover (native/desktop/mobile-web); as sevak/admin, Create is present and works

Only sevak-and-above (or global admins) can create events. Beta pilot
coordinators (e.g. San Jose / Dallas) are provisioned at SEVAK; they
invite normal members to their center, who can RSVP and join boards but
not create events.

- backend: /addEvent rejects below-SEVAK callers with 403
- frontend: hide the "Create" entry point on Discover (native, desktop
  web, and the mobile-web fallback) for non-coordinators; mirrors the
  backend gate via isSevakOrAdmin()
- replaces the temporary "beta: any signed-in user can create" scaffolding
- tests: promote event-creating fixtures to SEVAK; add a 403 negative test
  for a normal member

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying chinmaya-janata with  Cloudflare Pages  Cloudflare Pages

Latest commit: c66ec5e
Status: ✅  Deploy successful!
Preview URL: https://2f36a412.project-janatha.pages.dev
Branch Preview URL: https://feat-admins-only-event-creat.project-janatha.pages.dev

View logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant