From 15cc3abb0eebd9f7c8b7474207dea26d12801eb6 Mon Sep 17 00:00:00 2001 From: Rodolfo Zitellini Date: Mon, 28 Oct 2024 10:17:54 +0100 Subject: [PATCH] Make inventories and inventory items disappear for non admins --- app/admin/inventory_item.rb | 3 +-- app/views/admin/sources/select_new_template.html.erb | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/admin/inventory_item.rb b/app/admin/inventory_item.rb index d19402b40..1f36f5406 100644 --- a/app/admin/inventory_item.rb +++ b/app/admin/inventory_item.rb @@ -1,9 +1,8 @@ ActiveAdmin.register InventoryItem do - collection_action :autocomplete_intentory_item_id, :method => :get # Hide the menu - menu :parent => "indexes_menu", :label => proc {I18n.t(:menu_inventory_items)} + menu :parent => "indexes_menu", :label => proc {I18n.t(:menu_inventory_items)}, :if => proc{ current_user.has_role?(:admin)} config.clear_action_items! # Remove mass-delete action diff --git a/app/views/admin/sources/select_new_template.html.erb b/app/views/admin/sources/select_new_template.html.erb index 1f5c63a44..7f1d6d443 100644 --- a/app/views/admin/sources/select_new_template.html.erb +++ b/app/views/admin/sources/select_new_template.html.erb @@ -5,6 +5,7 @@
<% templates.each do |toplevel, template_list| %> + <% next if toplevel == "inventories" && !current_user.has_role?(:admin) %>

<%= I18n.t('record_types.' + toplevel) %>
    <% template_list.each do |label, properties| %>