Commit c58f55f8 by Oláh István Gergely

dashboard: add getqueryset to GroupList and fix get

parent f45d9e43
...@@ -1002,7 +1002,21 @@ class GroupList(LoginRequiredMixin, SuperuserRequiredMixin, SingleTableView): ...@@ -1002,7 +1002,21 @@ class GroupList(LoginRequiredMixin, SuperuserRequiredMixin, SingleTableView):
content_type="application/json", content_type="application/json",
) )
else: else:
return super(VmList, self).get(*args, **kwargs) return super(GroupList, self).get(*args, **kwargs)
def get_queryset(self):
user = self.request.user
logger.debug('GroupList.get_queryset() called. User: %s',
unicode(self.request.user))
groups = []
if user.has_module_perms('auth'):
pks = [i[0] for i in GroupProfile.get_objects_with_level(
'operator', user).values_list('pk')]
groups = Group.objects.filter(groupprofile__in=pks)
s = self.request.GET.get("s")
if s:
groups = groups.filter(name__icontains=s)
return groups
class GroupUserDelete(LoginRequiredMixin, SuperuserRequiredMixin, DeleteView): class GroupUserDelete(LoginRequiredMixin, SuperuserRequiredMixin, DeleteView):
......
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