Skip to content

Commit

Permalink
Use authorized_for()
Browse files Browse the repository at this point in the history
  • Loading branch information
kdp-cloud committed Nov 22, 2023
1 parent 05a748a commit e79aa83
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/isa_exporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ def group_samples_by_input_and_parameter_value(sample_type)

def process_sequence_input(inputs, type)
input_ids = inputs.map { |input| input[:id] }
authorized_sample_ids = Sample.where(id: input_ids).select { |s| s.can_view?(@current_user) }.map(&:id).compact
authorized_sample_ids = Sample.where(id: input_ids).authorized_for(:view, @current_user).map(&:id)
input_ids.map do |input_id|
if authorized_sample_ids.include?(input_id)
{ '@id': "##{type}/#{input_id}" }
Expand Down Expand Up @@ -696,7 +696,7 @@ def convert_parameter_values(sample_group_hash, isa_parameter_value_attributes)

def extract_sample_ids(input_obj_list, type)
sample_ids = input_obj_list.map { |io| io[:id] }
authorized_sample_ids = Sample.where(id: sample_ids).select { |sample| sample.can_view?(@current_user) }.map(&:id)
authorized_sample_ids = Sample.where(id: sample_ids).authorized_for(:view, @current_user).map(&:id)

sample_ids.map do |s_id|
if authorized_sample_ids.include?(s_id)
Expand Down

0 comments on commit e79aa83

Please sign in to comment.