From 5784a9db200449c1af7295e194c75fab696e4e6e Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Mon, 25 Dec 2017 20:34:33 +0800 Subject: [PATCH] Allow admin to override multiple submissions setting --- lib/builder.rb | 2 +- lib/wizard_edits.rb | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/builder.rb b/lib/builder.rb index e2a440b1..70d24314 100644 --- a/lib/builder.rb +++ b/lib/builder.rb @@ -49,7 +49,7 @@ class CustomWizard::Builder end def build - unless (@wizard.completed? && !@wizard.multiple_submissions) || !@steps || !@wizard.permitted? + unless (@wizard.completed? && !@wizard.multiple_submissions && !@wizard.user.admin) || !@steps || !@wizard.permitted? @steps.each do |s| @wizard.append_step(s['id']) do |step| step.title = s['title'] if s['title'] diff --git a/lib/wizard_edits.rb b/lib/wizard_edits.rb index 99287736..dde3d751 100644 --- a/lib/wizard_edits.rb +++ b/lib/wizard_edits.rb @@ -71,7 +71,9 @@ end end def include_completed? - object.completed? && (!object.respond_to?(:multiple_submissions) || !object.multiple_submissions) + object.completed? && + (!object.respond_to?(:multiple_submissions) || !object.multiple_submissions) && + !scope.is_admin? end def min_trust