thesis v0.3.4 Thesis.Auth behaviour
Thesis.Auth is an Elixir "behaviour" that defines the public function interface necessary for Thesis to determine whether the current session has the authority to edit.
There is only one required function, as described below.
Ensure that your app specifies the proper module in your configuration options.
For example, in config/config.ex
:
config :thesis,
store: Thesis.EctoStore,
authorization: MyApp.ThesisAuth
config :thesis, Thesis.EctoStore, repo: MyApp.Repo
Link to this section Summary
Callbacks
Returns true/false, whether a page is editable or not. Used to determine whether to load and display the Thesis editor and also whether to allow updates to Thesis.Page and Thesis.PageContent areas
Link to this section Callbacks
Link to this callback
page_is_editable?(arg0)
page_is_editable?(arg0)
page_is_editable?(Plug.Conn.t()) :: boolean()
page_is_editable?(Plug.Conn.t()) :: boolean()
Returns true/false, whether a page is editable or not. Used to determine whether to load and display the Thesis editor and also whether to allow updates to Thesis.Page and Thesis.PageContent areas.
Typical example:
defmodule MyApp.ThesisAuth do
@behaviour Thesis.Auth
def page_is_editable?(conn) do
conn
|> MyApp.AuthController.current_user_is_admin?(conn)
end
end