Canister feature admins only

This commit is contained in:
TheNeedful-DO 2024-03-11 02:38:00 +00:00
parent fe8aa648a6
commit 09c80c22b4
3 changed files with 9 additions and 5 deletions

View File

@ -3,7 +3,8 @@ class VisitorsController < ApplicationController
def index def index
@doodads = authorize policy_scope(Doodad) @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]) @feed_items = current_user.feed.paginate(page: params[:page])
end end

View File

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

View File

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