(self, params, **kwargs)
| 2642 | return run_as_parser |
| 2643 | |
| 2644 | def execute(self, params, **kwargs): |
| 2645 | from .. import native |
| 2646 | |
| 2647 | record_name = kwargs.get('record') |
| 2648 | record = base.RecordMixin.resolve_single_record(params, record_name) |
| 2649 | if not record: |
| 2650 | raise CommandError('', f'Record \"{record_name}\" not found.') |
| 2651 | |
| 2652 | username = base.RecordMixin.get_record_field(record, 'login') |
| 2653 | if not username: |
| 2654 | raise CommandError('', f'Username not found on record \"{record.title}\"') |
| 2655 | |
| 2656 | password = base.RecordMixin.get_record_field(record, 'password') |
| 2657 | if not password: |
| 2658 | raise CommandError('', f'Password not found on record \"{record.title}\"') |
| 2659 | |
| 2660 | try: |
| 2661 | native.run_as(username, password, kwargs.get('application')) |
| 2662 | except OSError as e: |
| 2663 | raise CommandError('', str(e)) |
| 2664 | |
| 2665 | |
| 2666 | class LoginStatusCommand(Command): |
nothing calls this directly
no test coverage detected