fix: sync LDAP notification error

pull/12552/head
wangruidong 2024-01-16 13:59:48 +08:00 committed by Bryan
parent 3c3c1499b7
commit 6cd3672604
2 changed files with 3 additions and 1 deletions

View File

@ -17,6 +17,7 @@ class LDAPImportMessage(UserMessage):
self.time_start_display = extra_kwargs.pop('time_start_display', '') self.time_start_display = extra_kwargs.pop('time_start_display', '')
self.new_users = extra_kwargs.pop('new_users', []) self.new_users = extra_kwargs.pop('new_users', [])
self.errors = extra_kwargs.pop('errors', []) self.errors = extra_kwargs.pop('errors', [])
self.cost_time = extra_kwargs.pop('cost_time', '')
def get_html_msg(self) -> dict: def get_html_msg(self) -> dict:
subject = _('Notification of Synchronized LDAP User Task Results') subject = _('Notification of Synchronized LDAP User Task Results')
@ -24,7 +25,7 @@ class LDAPImportMessage(UserMessage):
'orgs': self.orgs, 'orgs': self.orgs,
'start_time': self.time_start_display, 'start_time': self.time_start_display,
'end_time': local_now_display(), 'end_time': local_now_display(),
'cost_time': self.end_time - self.start_time, 'cost_time': self.cost_time,
'users': self.new_users, 'users': self.new_users,
'errors': self.errors 'errors': self.errors
} }

View File

@ -57,6 +57,7 @@ def import_ldap_user():
'time_start_display': time_start_display, 'time_start_display': time_start_display,
'new_users': new_users, 'new_users': new_users,
'errors': errors, 'errors': errors,
'cost_time': end_time - start_time,
} }
for user in recipient_list: for user in recipient_list:
LDAPImportMessage(user, extra_kwargs).publish() LDAPImportMessage(user, extra_kwargs).publish()