diff --git a/authentik/sources/ldap/sync/users.py b/authentik/sources/ldap/sync/users.py index 6a8aefb27..e48485af8 100644 --- a/authentik/sources/ldap/sync/users.py +++ b/authentik/sources/ldap/sync/users.py @@ -78,6 +78,6 @@ class UserLDAPSynchronizer(BaseLDAPSynchronizer): ak_user.save() if "userAccountControl" in attributes: uac = UserAccountControl(attributes.get("userAccountControl")) - ak_user.is_active = UserAccountControl.ACCOUNTDISABLE in uac + ak_user.is_active = UserAccountControl.ACCOUNTDISABLE not in uac ak_user.save() return user_count diff --git a/authentik/sources/ldap/tests/mock_ad.py b/authentik/sources/ldap/tests/mock_ad.py index 3418e52af..0858fe86a 100644 --- a/authentik/sources/ldap/tests/mock_ad.py +++ b/authentik/sources/ldap/tests/mock_ad.py @@ -2,6 +2,8 @@ from ldap3 import MOCK_SYNC, OFFLINE_AD_2012_R2, Connection, Server +from authentik.sources.ldap.sync.vendor.ad import UserAccountControl + def mock_ad_connection(password: str) -> Connection: """Create mock AD connection""" @@ -54,7 +56,8 @@ def mock_ad_connection(password: str) -> Connection: "objectSid": "user0", "objectClass": "person", "distinguishedName": "cn=user0,ou=users,dc=goauthentik,dc=io", - "userAccountControl": 66050, + "userAccountControl": UserAccountControl.ACCOUNTDISABLE + + UserAccountControl.NORMAL_ACCOUNT, }, ) # User without SID diff --git a/web/package-lock.json b/web/package-lock.json index 008b49638..b4d3661a2 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -6992,7 +6992,7 @@ "node_modules/require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/view==", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", "engines": { "node": ">=0.10.0" } @@ -13757,7 +13757,7 @@ "require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/view==" + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==" }, "require-main-filename": { "version": "2.0.0",