management: upgrade wc-base-import-command (#75510)
gitea/authentic2-wallonie-connect/pipeline/head This commit looks good Details

This commit is contained in:
Paul Marillonnet 2023-03-16 14:36:32 +01:00
parent beb6d259d2
commit e09c197829
1 changed files with 6 additions and 9 deletions

View File

@ -15,13 +15,10 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
import functools
import json
from django.db import transaction
from django.utils import six
from authentic2_idp_oidc.models import OIDCClient, OIDCClaim, generate_uuid
from authentic2.a2_rbac.models import Role, OrganizationalUnit
@ -127,7 +124,7 @@ class Command(BaseCommand):
client_id = service.get("client_id")
client_secret = service.get("client_secret")
frontchannel_logout_uri = service["frontchannel_logout_uri"]
assert isinstance(frontchannel_logout_uri, six.text_type)
assert isinstance(frontchannel_logout_uri, str)
post_logout_redirect_uris = service.get("post_logout_redirect_uris", [])
assert isinstance(post_logout_redirect_uris, list)
open_to_all = service.get("open_to_all", False)
@ -277,15 +274,15 @@ class Command(BaseCommand):
value = claim["value"]
scopes = claim["scopes"]
assert name and isinstance(
name, six.string_types
name, str
), "claim's name must be a non-empty string"
assert value and isinstance(
name, six.string_types
name, str
), "claim's value must be a non-empty string"
assert (
scopes
and isinstance(scopes, list)
and all(isinstance(x, six.string_types) for x in scopes)
and all(isinstance(x, str) for x in scopes)
), "claim's scope must be a non-empty list of strings"
oidc_claim, created = OIDCClaim.objects.get_or_create(
@ -334,7 +331,7 @@ class Command(BaseCommand):
assert string_key in content_user, "missing key " + string_key
value = content_user[string_key]
if imported_password:
assert isinstance(value, six.text_type), (
assert isinstance(value, str), (
"invalid type for key " + string_key
)
if string_key in required:
@ -345,7 +342,7 @@ class Command(BaseCommand):
assert "password" in data
uuid = content_user.get("uuid") or None
assert uuid is None or (
isinstance(uuid, six.text_type) and uuid
isinstance(uuid, str) and uuid
), "invalid uuid %s %s" % (uuid, content_user)
allowed_services = content_user.get("allowed_services", [])
assert isinstance(allowed_services, list)