From bea128da5bf9103253b2848d99e26a0965be651d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sat, 12 Sep 2020 11:32:04 +0200 Subject: [PATCH] sync-cut: ignore duplicated oidc accounts --- src/authentic2_gnm/management/commands/sync-cut.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/authentic2_gnm/management/commands/sync-cut.py b/src/authentic2_gnm/management/commands/sync-cut.py index 3b1bb92..433872d 100644 --- a/src/authentic2_gnm/management/commands/sync-cut.py +++ b/src/authentic2_gnm/management/commands/sync-cut.py @@ -21,6 +21,7 @@ import requests from django.conf import settings from django.core.management.base import BaseCommand +from django.core.exceptions import MultipleObjectsReturned from authentic2.utils.template import Template from authentic2_auth_oidc.models import OIDCProvider, OIDCAccount @@ -74,6 +75,8 @@ class Command(BaseCommand): account = OIDCAccount.objects.get(user__email=user_dict['email']) except OIDCAccount.DoesNotExist: continue + except MultipleObjectsReturned: + continue had_changes = False for claim in cut_users.claim_mappings.all(): if '{{' in claim.claim or '{%' in claim.claim: