Personal calendars for PhoenixKit — one implicit calendar per user, with fine-grained permissions over other people's calendars.
Permission model
This module is the reference consumer of PhoenixKit's fine-grained sub-permissions:
| Key | Grants |
|---|---|
calendar | The calendar admin page + full control of YOUR OWN calendar |
calendar.view_others | Read-only access to other users' calendars |
calendar.edit_others | Create/edit/delete events on other users' calendars |
Typical role setup (created in /admin/users/roles, granted in the
permissions matrix):
- Employee —
calendar(own calendar only) - Junior Manager —
calendar+calendar.view_others - Boss —
calendar+calendar.view_others+calendar.edit_others
Admin and Owner hold every key by default (Owner always; Admin via seeding/auto-grant, revocable by the Owner in the matrix).
Authorization happens at the context layer (PhoenixKitCalendar.Events) —
every function takes the caller's scope and checks it against the event's
owner, so the rules hold no matter which UI drives it.
Data model
phoenix_kit_calendar_events (core migration V141): events keyed by
owner_uuid (CASCADE on user delete). Timed events store an
exclusive-end UTC pair; all-day events store an exclusive-end DATE pair
([start, end), iCal-style — matching phoenix_live_calendar).
Recurrence is deliberately out of scope for v1.
UI
/admin/calendar renders the month view via the standalone
phoenix_live_calendar library (server-rendered; JS hooks are optional
progressive enhancement). Users holding calendar.view_others get a
person switcher listing all active users — including people who no
longer hold calendar access, so an admin can always review old events —
annotated with whether each user has events and whether they currently
hold calendar access.
Summary
Functions
Admin sidebar tab. The route is auto-generated from live_view.
OTP apps whose templates Tailwind should scan for CSS classes.
Disables the module. Same pattern as enable_system/0.
Enables the module by persisting a boolean setting.
Whether the module is currently enabled.
Unique key for this module. Used in settings, permissions, and PubSub events.
Display name shown in the admin UI.
Permission metadata for the roles/permissions matrix.
Version string. Shown on the admin Modules page. Reads the app spec so it can't drift from mix.exs.
Functions
Admin sidebar tab. The route is auto-generated from live_view.
OTP apps whose templates Tailwind should scan for CSS classes.
Disables the module. Same pattern as enable_system/0.
Enables the module by persisting a boolean setting.
Whether the module is currently enabled.
Reads from the DB-backed settings table; defensive against DB
unavailability around startup (all failure branches return false).
Unique key for this module. Used in settings, permissions, and PubSub events.
Display name shown in the admin UI.
Permission metadata for the roles/permissions matrix.
Declares the base calendar key plus the two fine-grained
sub-permissions gating access to OTHER users' calendars. Sub-keys are
stored as "calendar.view_others" / "calendar.edit_others" and
checked in the Events context via PhoenixKit.Users.Auth.Scope.can?/2.
Version string. Shown on the admin Modules page. Reads the app spec so it can't drift from mix.exs.