Commit 31295e76 by Őry Máté

dashboard: fix lease permissions

parent c11cf23e
...@@ -26,9 +26,11 @@ ...@@ -26,9 +26,11 @@
<div class="col-md-6"> <div class="col-md-6">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
{% if perms.vm.create_leases %}
<a href="{% url "dashboard.views.lease-create" %}" class="pull-right btn btn-success btn-xs" style="margin-right: 10px;"> <a href="{% url "dashboard.views.lease-create" %}" class="pull-right btn btn-success btn-xs" style="margin-right: 10px;">
<i class="icon-plus"></i> {% trans "new lease" %} <i class="icon-plus"></i> {% trans "new lease" %}
</a> </a>
{% endif %}
<h3 class="no-margin"><i class="icon-time"></i> {% trans "Leases" %}</h3> <h3 class="no-margin"><i class="icon-time"></i> {% trans "Leases" %}</h3>
</div> </div>
<div class="panel-body"> <div class="panel-body">
......
...@@ -2285,10 +2285,11 @@ class VmMassDelete(LoginRequiredMixin, View): ...@@ -2285,10 +2285,11 @@ class VmMassDelete(LoginRequiredMixin, View):
return redirect(next if next else reverse_lazy('dashboard.index')) return redirect(next if next else reverse_lazy('dashboard.index'))
class LeaseCreate(LoginRequiredMixin, SuperuserRequiredMixin, class LeaseCreate(LoginRequiredMixin, PermissionRequiredMixin,
SuccessMessageMixin, CreateView): SuccessMessageMixin, CreateView):
model = Lease model = Lease
form_class = LeaseForm form_class = LeaseForm
permission_required = 'vm.create_leases'
template_name = "dashboard/lease-create.html" template_name = "dashboard/lease-create.html"
success_message = _("Successfully created a new lease.") success_message = _("Successfully created a new lease.")
......
...@@ -97,7 +97,6 @@ class Lease(AclBase): ...@@ -97,7 +97,6 @@ class Lease(AclBase):
ordering = ['name', ] ordering = ['name', ]
permissions = ( permissions = (
('create_leases', _('Can create new leases.')), ('create_leases', _('Can create new leases.')),
('bypass_leases', _('Can set arbitrary expiration times.')),
) )
@property @property
......
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