From 0adb9e0d5e3ec81a19b641b8e6141a3a8d6e9c1b Mon Sep 17 00:00:00 2001 From: wangruidong <940853815@qq.com> Date: Tue, 3 Dec 2024 17:42:56 +0800 Subject: [PATCH] feat: mongodb accounts gather --- .../automations/gather_account/filter.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/apps/accounts/automations/gather_account/filter.py b/apps/accounts/automations/gather_account/filter.py index 63e2ebe17..757232fe3 100644 --- a/apps/accounts/automations/gather_account/filter.py +++ b/apps/accounts/automations/gather_account/filter.py @@ -213,6 +213,22 @@ class GatherAccountsFilter: result[user['username']] = user return result + @staticmethod + def mongodb_filter(info): + result = {} + for db, users in info.items(): + for username, user_info in users.items(): + user = { + 'username': username, + 'date_password_change': None, + 'date_password_expired': None, + 'date_last_login': None, + 'groups': '', + } + result['detail'] = {'db': db, 'roles': user_info.get('roles', [])} + result[username] = user + return result + def run(self, method_id_meta_mapper, info): run_method_name = None for k, v in method_id_meta_mapper.items():