Chime.Router.Admin (Chime v0.1.0-dev)

Copy Markdown View Source

The admin, mounted with chime_admin/2 (imported with Chime.Router): a person's notifications and their log, the events, the deliveries that failed and a way to send them again.

scope "/admin" do
  pipe_through [:browser, :require_admin]

  chime_admin "/notifications",
    access: MyAppWeb.ChimeAdminAccess,
    on_mount: [{MyAppWeb.AdminAuth, :require_admin}]
end

:access is a module of Chime.Admin.Access, asked on the request of the page: Chime fails closed, and the admin is a 404 to anyone it does not allow. Mount it behind the app's admin pipeline and its on_mount all the same.

Summary

Functions

Mounts Chime.Router.Admin at path in a host router.

Functions

chime_admin(path, opts \\ [])

(macro)

Mounts Chime.Router.Admin at path in a host router.

import Chime.Router.Admin

scope "/" do
  pipe_through :browser
  chime_admin "/chime"
end

Options

  • :access (atom/0) - Required. The app's Chime.Admin.Access: who may see the admin.

  • :otp_app (atom/0) - The app whose notifiers the previews show: its modules of Chime.Notifier with preview/0. Without it, the notifiers loaded.

Every mount also takes the options listed in PhoenixMountable, such as :as, :on_mount and :csp_nonce_assign_key.