Commit 05d1cfef by Guba Sándor

operation: set owner ACL level fixes #350

parent 8fbfca30
...@@ -734,9 +734,13 @@ class SaveAsTemplateOperation(InstanceOperation): ...@@ -734,9 +734,13 @@ class SaveAsTemplateOperation(InstanceOperation):
tmpl = InstanceTemplate(**params) tmpl = InstanceTemplate(**params)
tmpl.full_clean() # Avoiding database errors. tmpl.full_clean() # Avoiding database errors.
tmpl.save() tmpl.save()
# Copy traits from the VM instance
tmpl.req_traits.add(*self.instance.req_traits.all()) tmpl.req_traits.add(*self.instance.req_traits.all())
if clone: if clone:
# Add permission for the original owner of the template
tmpl.clone_acl(self.instance.template) tmpl.clone_acl(self.instance.template)
tmpl.set_level(self.instance.template.owner, 'owner')
tmpl.set_level(user, 'owner')
try: try:
tmpl.disks.add(*self.disks) tmpl.disks.add(*self.disks)
# create interface templates # create interface templates
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment