'Populates self._group_permissions based on LDAP group membership and
Django group permissions.'

def _load_group_permissions(self):

    group_names = self._get_groups().get_group_names()
    perms = Permission.objects.filter(group__name__in=group_names)
    perms = perms.values_list('content_type__app_label', 'codename')
    perms = perms.order_by()
    self._group_permissions = set([('%s.%s' % (ct, name)) for (ct, name) in perms])
