Commit ba3fcdc2 by Kálmán Viktor

vm: better way to check op auth

parent 1077621c
......@@ -615,10 +615,14 @@ class ResourcesOperation(InstanceOperation):
if self.instance.status in ['RUNNING']:
raise self.instance.WrongStateError(self.instance)
def _operation(self, user, num_cores, ram_size, max_ram_size, priority):
def check_auth(self, user):
if not user.has_perm('vm.change_resources'):
raise PermissionDenied()
super(InstanceOperation, self).check_auth(user=user)
def _operation(self, user, num_cores, ram_size, max_ram_size, priority):
self.instance.num_cores = num_cores
self.instance.ram_size = ram_size
self.instance.max_ram_size = max_ram_size
......
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