(data, _console, _json)
| 591 | return usr.id |
| 592 | |
| 593 | def display_user(data, _console, _json): |
| 594 | if _console: |
| 595 | if _json: |
| 596 | json_formatted_str = jsonlib.dumps(data, indent=0) |
| 597 | console.print(json_formatted_str) |
| 598 | else: |
| 599 | if isinstance(data, dict): |
| 600 | data = [data] |
| 601 | for _data in data: |
| 602 | table = Table(title="User Details", box=box.ASCII) |
| 603 | table.add_column("Field", style="green") |
| 604 | table.add_column("Value", style="green") |
| 605 | |
| 606 | if 'username' in _data: |
| 607 | table.add_row("Username", _data['username']) |
| 608 | if 'email' in _data: |
| 609 | table.add_row("Email", _data['email']) |
| 610 | table.add_row("auth_source", _data['auth_source']) |
| 611 | table.add_row("role", _data['role']) |
| 612 | table.add_row("active", |
| 613 | 'True' if _data['active'] else 'False') |
| 614 | console.print(table) |
| 615 | |
| 616 | |
| 617 | class ManagePreferences: |
no test coverage detected