Update the routes to add authentication if needed.
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -35,8 +35,34 @@ defmodule DecentralisedBookIndexWeb.Router do
|
|||||||
scope "/", DecentralisedBookIndexWeb do
|
scope "/", DecentralisedBookIndexWeb do
|
||||||
pipe_through :browser
|
pipe_through :browser
|
||||||
|
|
||||||
|
ash_authentication_live_session :maybe_authenticated_routes, on_mount: {DecentralisedBookIndexWeb.LiveUserAuth, :live_user_optional} do
|
||||||
|
# in each liveview, add one of the following at the top of the module:
|
||||||
|
#
|
||||||
|
# If an authenticated user must be present:
|
||||||
|
# on_mount {DecentralisedBookIndexWeb.LiveUserAuth, :live_user_required}
|
||||||
|
#
|
||||||
|
# If an authenticated user *may* be present:
|
||||||
|
# on_mount {DecentralisedBookIndexWeb.LiveUserAuth, :live_user_optional}
|
||||||
|
#
|
||||||
|
# If an authenticated user must *not* be present:
|
||||||
|
# on_mount {DecentralisedBookIndexWeb.LiveUserAuth, :live_no_user}
|
||||||
|
|
||||||
live "/", BookLive.Index, :index
|
live "/", BookLive.Index, :index
|
||||||
|
|
||||||
|
live "/books", BookLive.Index, :index
|
||||||
|
live "/books/:id", BookLive.Show, :show
|
||||||
|
|
||||||
|
live "/authors", AuthorLive.Index, :index
|
||||||
|
live "/authors/:id", AuthorLive.Show, :show
|
||||||
|
end
|
||||||
|
|
||||||
|
ash_authentication_live_session :authenticated_routes, on_mount: {DecentralisedBookIndexWeb.LiveUserAuth, :live_user_required} do
|
||||||
|
live "/books/new", BookLive.Edit, :new
|
||||||
|
live "/books/:id/edit", BookLive.Edit, :edit
|
||||||
|
|
||||||
|
live "/authors/new", AuthorLive.Edit, :new
|
||||||
|
live "/authors/:id/edit", AuthorLive.Edit, :edit
|
||||||
|
|
||||||
live "/publishers", PublisherLive.Index, :index
|
live "/publishers", PublisherLive.Index, :index
|
||||||
live "/publishers/new", PublisherLive.Index, :new
|
live "/publishers/new", PublisherLive.Index, :new
|
||||||
live "/publishers/:id/edit", PublisherLive.Index, :edit
|
live "/publishers/:id/edit", PublisherLive.Index, :edit
|
||||||
@@ -50,32 +76,6 @@ defmodule DecentralisedBookIndexWeb.Router do
|
|||||||
|
|
||||||
live "/servers/:id", DbiServerLive.Show, :show
|
live "/servers/:id", DbiServerLive.Show, :show
|
||||||
live "/servers/:id/show/edit", DbiServerLive.Show, :edit
|
live "/servers/:id/show/edit", DbiServerLive.Show, :edit
|
||||||
|
|
||||||
ash_authentication_live_session :authenticated_routes do
|
|
||||||
# in each liveview, add one of the following at the top of the module:
|
|
||||||
#
|
|
||||||
# If an authenticated user must be present:
|
|
||||||
# on_mount {DecentralisedBookIndexWeb.LiveUserAuth, :live_user_required}
|
|
||||||
#
|
|
||||||
# If an authenticated user *may* be present:
|
|
||||||
# on_mount {DecentralisedBookIndexWeb.LiveUserAuth, :live_user_optional}
|
|
||||||
#
|
|
||||||
# If an authenticated user must *not* be present:
|
|
||||||
# on_mount {DecentralisedBookIndexWeb.LiveUserAuth, :live_no_user}
|
|
||||||
|
|
||||||
live "/books", BookLive.Index, :index
|
|
||||||
live "/books/new", BookLive.Edit, :new
|
|
||||||
live "/books/:id/edit", BookLive.Edit, :edit
|
|
||||||
|
|
||||||
live "/books/:id", BookLive.Show, :show
|
|
||||||
live "/books/:id/show/edit", BookLive.Show, :edit
|
|
||||||
|
|
||||||
live "/authors", AuthorLive.Index, :index
|
|
||||||
live "/authors/new", AuthorLive.Edit, :new
|
|
||||||
live "/authors/:id/edit", AuthorLive.Edit, :edit
|
|
||||||
|
|
||||||
live "/authors/:id", AuthorLive.Show, :show
|
|
||||||
live "/authors/:id/show/edit", AuthorLive.Show, :edit
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user