mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-11-09 16:01:30 +08:00
Fix canvas update method [SCI-4817]
This commit is contained in:
parent
94588e4698
commit
7bedbd3511
1 changed files with 3 additions and 6 deletions
|
|
@ -33,10 +33,7 @@ class CanvasController < ApplicationController
|
||||||
to_archive = []
|
to_archive = []
|
||||||
if update_params[:remove].present?
|
if update_params[:remove].present?
|
||||||
to_archive = update_params[:remove].split(',')
|
to_archive = update_params[:remove].split(',')
|
||||||
if to_archive.all? do |id|
|
if to_archive.all? { |id| can_archive_module?(MyModule.find_by(id: id)) }
|
||||||
is_int?(id) &&
|
|
||||||
can_archive_module?(MyModule.find_by(id: id))
|
|
||||||
end
|
|
||||||
to_archive.collect!(&:to_i)
|
to_archive.collect!(&:to_i)
|
||||||
else
|
else
|
||||||
return render_403
|
return render_403
|
||||||
|
|
@ -117,10 +114,10 @@ class CanvasController < ApplicationController
|
||||||
# Okay, JSON parsed!
|
# Okay, JSON parsed!
|
||||||
unless to_move.is_a?(Hash) &&
|
unless to_move.is_a?(Hash) &&
|
||||||
to_move.keys.all? do |id|
|
to_move.keys.all? do |id|
|
||||||
id.is_a?(String) && can_move_module?(MyModule.find_by(id: id))
|
!is_int?(id) || can_move_module?(MyModule.find_by(id: id))
|
||||||
end &&
|
end &&
|
||||||
to_move.values.all? do |exp_id|
|
to_move.values.all? do |exp_id|
|
||||||
exp_id.is_a?(String) && can_manage_experiment?(Experiment.find_by(id: exp_id))
|
can_manage_experiment?(Experiment.find_by(id: exp_id))
|
||||||
end
|
end
|
||||||
return render_403
|
return render_403
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue