aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobert2017-10-17 12:28:35 +0200
committerRobert2017-10-17 12:28:35 +0200
commit0b744d48fdc84445f593114fe61baaafca4e17f4 (patch)
treed15b8473b79cdd7fd809f3a942b2acec2cb8a2f9 /lib
parentbacb624a9d0415337dfab6418de240cd2afa7305 (diff)
downloadchouette-core-0b744d48fdc84445f593114fe61baaafca4e17f4.tar.bz2
Fixes: #4727@0.1h; Added organisation to clone for and rebased master4727-clone-compliance-control-set
Diffstat (limited to 'lib')
-rw-r--r--lib/compliance_control_set_cloner.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/compliance_control_set_cloner.rb b/lib/compliance_control_set_cloner.rb
index 3856ce25e..1cf58a38d 100644
--- a/lib/compliance_control_set_cloner.rb
+++ b/lib/compliance_control_set_cloner.rb
@@ -4,10 +4,11 @@ class ComplianceControlSetCloner
# abbreviate compliance_control to cc and
# compliance_check to cck iff used as prefixes.
- attr_reader :source_set_id
-
- def copy source_set_id
+ attr_reader :organisation_id, :source_set_id
+
+ def copy source_set_id, organisation_id
@source_set_id = source_set_id
+ @organisation_id = organisation_id
copy_set
end
@@ -71,12 +72,15 @@ class ComplianceControlSetCloner
# Lazy Values
# -----------
+ def organisation
+ @__organisation__ ||= Organisation.find(organisation_id)
+ end
def source_set
@__source_set__ ||= ComplianceControlSet.find(source_set_id)
end
def target_set
@__target_set__ ||= ComplianceControlSet.create!(
- organisation: source_set.organisation,
+ organisation: organisation,
name: name_of_copy(:compliance_control_sets, source_set.name)
)
end