Commit 1562a44a by Őry Máté

dashboard: deny removing owners permissions

parent d228d60b
...@@ -323,8 +323,12 @@ class AclUpdateView(LoginRequiredMixin, View, SingleObjectMixin): ...@@ -323,8 +323,12 @@ class AclUpdateView(LoginRequiredMixin, View, SingleObjectMixin):
for key, value in request.POST.items(): for key, value in request.POST.items():
m = re.match('perm-([ug])-(\d+)', key) m = re.match('perm-([ug])-(\d+)', key)
if m: if m:
type, id = m.groups() typ, id = m.groups()
entity = {'u': User, 'g': Group}[type].objects.get(id=id) entity = {'u': User, 'g': Group}[typ].objects.get(id=id)
if instance.owner == entity:
logger.info("Tried to set owner's acl level for %s by %s.",
unicode(instance), unicode(request.user))
continue
instance.set_level(entity, value) instance.set_level(entity, value)
logger.info("Set %s's acl level for %s to %s by %s.", logger.info("Set %s's acl level for %s to %s by %s.",
unicode(entity), unicode(instance), unicode(entity), unicode(instance),
...@@ -416,7 +420,7 @@ class VmList(LoginRequiredMixin, SingleTableView): ...@@ -416,7 +420,7 @@ class VmList(LoginRequiredMixin, SingleTableView):
model = Instance model = Instance
def get_queryset(self): def get_queryset(self):
logger.debug('VmList.get_queryset() claled. User: %s', logger.debug('VmList.get_queryset() called. User: %s',
unicode(self.request.user)) unicode(self.request.user))
return Instance.get_objects_with_level( return Instance.get_objects_with_level(
'user', self.request.user).filter(destroyed=None).all() 'user', self.request.user).filter(destroyed=None).all()
......
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