Update the navbar and routes to check the User's role.
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -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
|
||||
<li>
|
||||
<a href={~p"/authors/"} class={selected_navbar_link_css(@page_title, "Listing Authors")} aria-current="page">Authors</a>
|
||||
</li>
|
||||
<%= if @current_user != nil do %>
|
||||
<%= if @current_user != nil and Role.can_moderate?(@current_user.role) do %>
|
||||
<li>
|
||||
<a href={~p"/publishers/"} class={selected_navbar_link_css(@page_title, "Listing Publishers")} aria-current="page">Publishers</a>
|
||||
</li>
|
||||
<% end %>
|
||||
<%= if @current_user != nil and Role.can_administrate?(@current_user.role) do %>
|
||||
<li>
|
||||
<a href={~p"/servers/"} class={selected_navbar_link_css(@page_title, "Listing Server")} aria-current="page">Servers</a>
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user