saml: convert querysets to proper lists (#42656)

This commit is contained in:
Frédéric Péters 2020-05-08 10:46:41 +02:00
parent 1c7ce14529
commit bbffe1bb8c
1 changed files with 3 additions and 0 deletions

View File

@ -25,6 +25,7 @@ from authentic2.utils import normalize_attribute_values
from django.db import models
from django.db.models import Q
from django.db.models.query import QuerySet
from django.conf import settings
from django.core.exceptions import ValidationError
from django.utils import six
@ -335,6 +336,8 @@ class SAMLAttribute(models.Model):
name = self.name
friendly_name = self.friendly_name or None
values = ctx.get(self.attribute_name)
if isinstance(values, QuerySet):
values = list(values)
if not isinstance(values, (list, tuple, set)):
values = [values]
for value in values: