sources/ldap: fix error when modifying ldap source with password write-back
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
884c2bd0e9
commit
2ec1ff2ebb
|
@ -27,7 +27,10 @@ class LDAPSourceSerializer(SourceSerializer):
|
||||||
"""Check that only a single source has password_sync on"""
|
"""Check that only a single source has password_sync on"""
|
||||||
sync_users_password = attrs.get("sync_users_password", True)
|
sync_users_password = attrs.get("sync_users_password", True)
|
||||||
if sync_users_password:
|
if sync_users_password:
|
||||||
if LDAPSource.objects.filter(sync_users_password=True).exists():
|
filter = LDAPSource.objects.filter(sync_users_password=True)
|
||||||
|
if self.instance:
|
||||||
|
filter = filter.exclude(pk=self.instance.pk)
|
||||||
|
if filter.exists():
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
"Only a single LDAP Source with password synchronization is allowed"
|
"Only a single LDAP Source with password synchronization is allowed"
|
||||||
)
|
)
|
||||||
|
|
Reference in New Issue