Commit aafa29bf by Kálmán Viktor

dashboard: create base vm with only base vm right

Closes #236
parent 18eec1a7
...@@ -450,8 +450,10 @@ class TemplateForm(forms.ModelForm): ...@@ -450,8 +450,10 @@ class TemplateForm(forms.ModelForm):
self.allowed_fields = () self.allowed_fields = ()
else: else:
self.allowed_fields = ( self.allowed_fields = (
'name', 'access_method', 'description', 'system', 'tags') 'name', 'access_method', 'description', 'system', 'tags',
if self.user.has_perm('vm.change_template_resources'): 'arch', 'lease')
if (self.user.has_perm('vm.change_template_resources')
or not self.instance.pk):
self.allowed_fields += tuple(set(self.fields.keys()) - self.allowed_fields += tuple(set(self.fields.keys()) -
set(['raw_data'])) set(['raw_data']))
if self.user.is_superuser: if self.user.is_superuser:
......
...@@ -1376,7 +1376,7 @@ class TemplateCreate(SuccessMessageMixin, CreateView): ...@@ -1376,7 +1376,7 @@ class TemplateCreate(SuccessMessageMixin, CreateView):
def get_context_data(self, *args, **kwargs): def get_context_data(self, *args, **kwargs):
context = super(TemplateCreate, self).get_context_data(*args, **kwargs) context = super(TemplateCreate, self).get_context_data(*args, **kwargs)
num_leases = Lease.get_objects_with_level("user", num_leases = Lease.get_objects_with_level("operator",
self.request.user).count() self.request.user).count()
can_create_leases = self.request.user.has_perm("create_leases") can_create_leases = self.request.user.has_perm("create_leases")
context.update({ context.update({
......
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