Updated from mail to extensionAttribute1 attribute for email address

This commit is contained in:
2023-11-02 12:15:12 -04:00
parent 4b869b40d8
commit 0c35426ed9

View File

@@ -115,12 +115,12 @@ for seafileUser in seafileUsers:
continue
else:
logger.debug("Found user {0} with active status {1} in seafile".format(seafileUser['email'], bool(seafileUser['is_active'])))
logger.debug("Checking if {0} user has an email, is active, and is in the seafile group".format(seafileUser['email']))
ldap.search(ldapBase, '(&(mail={0})(!(userAccountControl:1.2.840.113556.1.4.803:=2))({1}))'.format(seafileUser['email'], ldapFilter), attributes=['*'])
logger.debug("Checking if {0} user has extensionAttribute1 set, is active, and is in the seafile group".format(seafileUser['email']))
ldap.search(ldapBase, '(&(extensionAttribute1={0})(!(userAccountControl:1.2.840.113556.1.4.803:=2))({1}))'.format(seafileUser['email'], ldapFilter), attributes=['*'])
count = len(ldap.entries)
logger.debug("Found {0} LDAP user.".format(count))
if count == 0:
logger.debug("User {0} doesn't have an email, isn't active, or isn't in the seafile group, disabling in seafile...".format(seafileUser['email']))
logger.debug("User {0} doesn't have extensionAttribute1 set, isn't active, or isn't in the seafile group, disabling in seafile...".format(seafileUser['email']))
if not seafileUser['is_active']:
logger.debug("User {0} is already disabled in Seafile".format(seafileUser['email']))
continue
@@ -130,7 +130,7 @@ for seafileUser in seafileUsers:
else:
logger.error("There was an error setting user {0} to disabled in Seafile".format(seafileUser['email']))
else:
logger.debug("User {0} has an email, is active, and is in the seafile group".format(seafileUser['email']))
logger.debug("User {0} has extensionAttribute1 set, is active, and is in the seafile group".format(seafileUser['email']))
if seafileUser['is_active']:
logger.debug("User {0} is already active in Seafile".format(seafileUser['email']))
continue