Canister feature admins only

This commit is contained in:
Jesse C. Fisher 2024-03-11 02:38:00 +00:00 committed by TheNeedful-DO
parent 0cb2fb1dce
commit 0c75a358fd
3 changed files with 9 additions and 5 deletions

View File

@ -3,7 +3,8 @@ class VisitorsController < ApplicationController
def index
@doodads = authorize policy_scope(Doodad)
@canisters = authorize Canister.all
# todo Canister feature
# @canisters = authorize Canister.all
@feed_items = current_user.feed.paginate(page: params[:page])
end

View File

@ -27,7 +27,7 @@ class CanisterPolicy
def index?
@current_user.admin? || true
@current_user.admin?
end
def show?
@ -35,11 +35,12 @@ class CanisterPolicy
end
def create?
@current_user.admin? || true
@current_user.admin?
end
def new?
@current_user.present?
# @current_user.present?
@current_user.admin?
end
def edit?

View File

@ -8,7 +8,9 @@
<li><%= link_to 'Profiles', profiles_path %></li>
<li><%= link_to 'Projects', projects_path %></li>
<li><%= link_to 'MetaPurse', metapurses_path %></li>
<% if policy(:canister).index? %>
<li><%= link_to 'Canisters', canisters_path %></li>
<% end %>
<li><%= link_to 'Doodads', doodads_path, data: { turbo: false } %></li>
<% if policy(:bot).index? %>
<li><%= link_to 'Bots', bots_path %></li>