diff --git a/lib/decentralised_book_index_web/components/my_partials/navbar.ex b/lib/decentralised_book_index_web/components/my_partials/navbar.ex
index 1187349..696e6ab 100644
--- a/lib/decentralised_book_index_web/components/my_partials/navbar.ex
+++ b/lib/decentralised_book_index_web/components/my_partials/navbar.ex
@@ -4,6 +4,7 @@ defmodule DecentralisedBookIndexWeb.Components.MyPartials.Navbar do
import DecentralisedBookIndexWeb.Components.MyComponents.Buttons
alias Phoenix.LiveView.JS
+ alias DecentralisedBookIndex.Accounts.Role
attr :page_title, :string, required: true
attr :current_user, :map, default: nil
@@ -28,10 +29,12 @@ defmodule DecentralisedBookIndexWeb.Components.MyPartials.Navbar do
Authors
- <%= if @current_user != nil do %>
+ <%= if @current_user != nil and Role.can_moderate?(@current_user.role) do %>
Publishers
+ <% end %>
+ <%= if @current_user != nil and Role.can_administrate?(@current_user.role) do %>
Servers
diff --git a/lib/decentralised_book_index_web/router.ex b/lib/decentralised_book_index_web/router.ex
index e1b96da..f8f379a 100644
--- a/lib/decentralised_book_index_web/router.ex
+++ b/lib/decentralised_book_index_web/router.ex
@@ -56,7 +56,7 @@ defmodule DecentralisedBookIndexWeb.Router do
live "/authors/:id", AuthorLive.Show, :show
end
- ash_authentication_live_session :authenticated_routes, on_mount: {DecentralisedBookIndexWeb.LiveUserAuth, :live_user_required} do
+ ash_authentication_live_session :moderator_authenticated_routes, on_mount: {DecentralisedBookIndexWeb.LiveUserAuth, :moderator_required} do
live "/books/new", BookLive.Edit, :new
live "/books/:id/edit", BookLive.Edit, :edit
@@ -69,7 +69,9 @@ defmodule DecentralisedBookIndexWeb.Router do
live "/publishers/:id", PublisherLive.Show, :show
live "/publishers/:id/show/edit", PublisherLive.Show, :edit
+ end
+ ash_authentication_live_session :admin_authenticated_routes, on_mount: {DecentralisedBookIndexWeb.LiveUserAuth, :admin_required} do
live "/servers", DbiServerLive.Index, :index
live "/servers/new", DbiServerLive.Index, :new
live "/servers/:id/edit", DbiServerLive.Index, :edit