From 2ef672ffb51a4abdbf8f4f2029214afc1aea01b2 Mon Sep 17 00:00:00 2001
From: "Ing. Jan KRCMAR" <honza801@civ.zcu.cz>
Date: Thu, 5 Oct 2017 07:58:01 +0200
Subject: [PATCH] user.is_staff can do resize of all machines

---
 instances/templates/instance.html | 2 +-
 instances/views.py                | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/instances/templates/instance.html b/instances/templates/instance.html
index 8e26148..39e9b7e 100644
--- a/instances/templates/instance.html
+++ b/instances/templates/instance.html
@@ -318,7 +318,7 @@
                                         <!-- Tab panes -->
                                         <div class="tab-content">
                                             <div role="tabpanel" class="tab-pane tab-pane-bordered active" id="resizevm">
-                                                {% if request.user.is_superuser or userinstace.is_change %}
+                                                {% if request.user.is_superuser or request.user.is_staff or userinstace.is_change %}
                                                     <form class="form-horizontal" method="post" role="form">{% csrf_token %}
                                                         <p style="font-weight:bold;">{% trans "Logical host CPUs:" %} {{ vcpu_host }}</p>
                                                         <div class="form-group">
diff --git a/instances/views.py b/instances/views.py
index 14b4eae..45b661a 100644
--- a/instances/views.py
+++ b/instances/views.py
@@ -446,7 +446,7 @@ def instance(request, compute_id, vname):
                     msg = _("Please shutdow down your instance and then try again")
                     error_messages.append(msg)
 
-            if 'resize' in request.POST and (request.user.is_superuser or userinstace.is_change):
+            if 'resize' in request.POST and (request.user.is_superuser or request.user.is_staff or userinstace.is_change):
                 new_vcpu = request.POST.get('vcpu', '')
                 new_cur_vcpu = request.POST.get('cur_vcpu', '')
                 new_memory = request.POST.get('memory', '')