(params)
| 20 | |
| 21 | |
| 22 | def create_user_report(params): # type: (KeeperParams) -> Optional[str] |
| 23 | user_report = UserReportCommand() |
| 24 | user_report_data = user_report.execute(params, format='json') |
| 25 | data = json.loads(user_report_data) |
| 26 | users = {x['email']: x for x in data} |
| 27 | security_audit_report = SecurityAuditReportCommand() |
| 28 | security_audit_report_data = security_audit_report.execute(params, format='json') |
| 29 | if security_audit_report_data: |
| 30 | data = json.loads(security_audit_report_data) |
| 31 | for x in data: |
| 32 | if 'email' in x: |
| 33 | email = x['email'] |
| 34 | if email in users: |
| 35 | user = users[email] |
| 36 | for key in x: |
| 37 | if key not in user: |
| 38 | if key not in ('node_path', 'username'): |
| 39 | user[key] = x[key] |
| 40 | else: |
| 41 | users[email] = x |
| 42 | |
| 43 | return json.dumps(list(users.values()), indent=2) |
| 44 | |
| 45 | |
| 46 | def lambda_handler(event, context): |
no test coverage detected