Commit c11cf23e by Őry Máté

dashboard: allow creating templates only with lease operators

parent c1b159b9
...@@ -612,6 +612,9 @@ class TemplateForm(forms.ModelForm): ...@@ -612,6 +612,9 @@ class TemplateForm(forms.ModelForm):
self.instance.ram_size = 512 self.instance.ram_size = 512
self.instance.num_cores = 2 self.instance.num_cores = 2
self.fields["lease"].queryset = Lease.get_objects_with_level(
"operator", self.user)
def clean_owner(self): def clean_owner(self):
if self.instance.pk is not None: if self.instance.pk is not None:
return User.objects.get(pk=self.instance.owner.pk) return User.objects.get(pk=self.instance.owner.pk)
......
...@@ -77,6 +77,7 @@ class Lease(AclBase): ...@@ -77,6 +77,7 @@ class Lease(AclBase):
""" """
ACL_LEVELS = ( ACL_LEVELS = (
('user', _('user')), # use this lease ('user', _('user')), # use this lease
('operator', _('operator')), # share this lease
('owner', _('owner')), # change this lease ('owner', _('owner')), # change this lease
) )
name = CharField(max_length=100, unique=True, name = CharField(max_length=100, unique=True,
......
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