diff --git a/app/controllers/storage_location_repository_rows_controller.rb b/app/controllers/storage_location_repository_rows_controller.rb index 579516a75..a35aa8cbf 100644 --- a/app/controllers/storage_location_repository_rows_controller.rb +++ b/app/controllers/storage_location_repository_rows_controller.rb @@ -6,7 +6,7 @@ class StorageLocationRepositoryRowsController < ApplicationController before_action :load_storage_location before_action :load_repository_row, only: %i(create update destroy move) before_action :check_read_permissions, except: %i(create actions_toolbar) - before_action :check_manage_permissions, only: %i(create update destroy) + before_action :check_manage_permissions, only: %i(create update destroy move) def index storage_location_repository_row = Lists::StorageLocationRepositoryRowsService.new( @@ -134,7 +134,7 @@ class StorageLocationRepositoryRowsController < ApplicationController end def check_manage_permissions - render_403 unless can_create_storage_location_repository_rows?(@storage_location) + render_403 unless can_manage_storage_location_repository_rows?(@storage_location) end def log_activity(type_of, message_items = {}) diff --git a/app/controllers/storage_locations_controller.rb b/app/controllers/storage_locations_controller.rb index 75673efc4..3bae95dd8 100644 --- a/app/controllers/storage_locations_controller.rb +++ b/app/controllers/storage_locations_controller.rb @@ -10,6 +10,7 @@ class StorageLocationsController < ApplicationController before_action :check_storage_locations_enabled, except: :unassign_rows before_action :load_storage_location, only: %i(update destroy duplicate move show available_positions unassign_rows export_container import_container) before_action :check_read_permissions, except: %i(index create tree actions_toolbar import_container unassign_rows) + before_action :check_manage_repository_rows_permissions, only: %i(import_container unassign_rows) before_action :check_create_permissions, only: :create before_action :check_manage_permissions, only: %i(update destroy duplicate move) before_action :set_breadcrumbs_items, only: %i(index show) @@ -230,6 +231,10 @@ class StorageLocationsController < ApplicationController render_403 unless can_manage_storage_location?(@storage_location) end + def check_manage_repository_rows_permissions + render_403 unless can_manage_storage_location_repository_rows?(@storage_location) + end + def set_breadcrumbs_items @breadcrumbs_items = [] diff --git a/app/javascript/vue/storage_locations/container.vue b/app/javascript/vue/storage_locations/container.vue index d4314000d..8a9839704 100644 --- a/app/javascript/vue/storage_locations/container.vue +++ b/app/javascript/vue/storage_locations/container.vue @@ -181,15 +181,15 @@ export default { type: 'emit', buttonStyle: 'btn btn-primary' }); - } - left.push({ - name: 'import', - icon: 'sn-icon sn-icon-import', - label: this.i18n.t('storage_locations.show.import_modal.import_button'), - type: 'emit', - buttonStyle: 'btn btn-light' - }); + left.push({ + name: 'import', + icon: 'sn-icon sn-icon-import', + label: this.i18n.t('storage_locations.show.import_modal.import_button'), + type: 'emit', + buttonStyle: 'btn btn-light' + }); + } return { left, diff --git a/app/services/toolbars/storage_location_repository_rows_service.rb b/app/services/toolbars/storage_location_repository_rows_service.rb index d0507f980..6c711248d 100644 --- a/app/services/toolbars/storage_location_repository_rows_service.rb +++ b/app/services/toolbars/storage_location_repository_rows_service.rb @@ -27,7 +27,7 @@ module Toolbars private def unassign_action - return unless can_read_storage_location?(@storage_location) + return unless can_manage_storage_location_repository_rows?(@storage_location) { name: 'unassign', @@ -39,7 +39,7 @@ module Toolbars end def move_action - return unless @single && can_read_storage_location?(@storage_location) + return unless @single && can_manage_storage_location_repository_rows?(@storage_location) { name: 'move', diff --git a/app/views/storage_locations/show.html.erb b/app/views/storage_locations/show.html.erb index 5c78f26f3..48a9a1af8 100644 --- a/app/views/storage_locations/show.html.erb +++ b/app/views/storage_locations/show.html.erb @@ -14,7 +14,7 @@ ref="container" actions-url="<%= actions_toolbar_storage_location_storage_location_repository_rows_path(@storage_location) %>" data-source="<%= storage_location_storage_location_repository_rows_path(@storage_location) %>" - :can-manage="<%= can_create_storage_location_repository_rows?(@storage_location) %>" + :can-manage="<%= can_manage_storage_location_repository_rows?(@storage_location) %>" :with-grid="<%= @storage_location.with_grid? %>" :grid-size="<%= @storage_location.grid_size.to_json %>" :container-id="<%= @storage_location.id %>"