diff options
author | Ruben Pollan <meskio@sindominio.net> | 2017-02-09 17:24:25 +0100 |
---|---|---|
committer | Ruben Pollan <meskio@sindominio.net> | 2017-02-23 00:26:46 +0100 |
commit | 59cd23bd3e23bf2b439ad26271733a1b5c8edf68 (patch) | |
tree | f8c82c7cc5e0e2fbda93e6fc92a08852a60d1961 /src/leap/bitmask/cli/keys.py | |
parent | 9f2b3b55ef08d908220f0b401aeec375d1c5ea07 (diff) |
[feat] eliminate the active user from bonafide
Active user is now only a concept of the cli. For it we add a
~/.config/leap/bitmaskctl.cfg file.
- Resolves: #8769
Diffstat (limited to 'src/leap/bitmask/cli/keys.py')
-rw-r--r-- | src/leap/bitmask/cli/keys.py | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/leap/bitmask/cli/keys.py b/src/leap/bitmask/cli/keys.py index 65747cb8..b11d2801 100644 --- a/src/leap/bitmask/cli/keys.py +++ b/src/leap/bitmask/cli/keys.py @@ -50,7 +50,11 @@ SUBCOMMANDS: help='Use private keys (by default uses public)') subargs = parser.parse_args(raw_args) - self.data += ['list', subargs.uid] + userid = subargs.userid + if not userid: + userid = self.cfg.get('bonafide', 'active', default='') + + self.data += ['list', userid] if subargs.private: self.data += ['private'] else: @@ -69,7 +73,11 @@ SUBCOMMANDS: parser.add_argument('address', nargs=1, help='email address of the key') subargs = parser.parse_args(raw_args) - self.data += ['export', subargs.uid, subargs.address[0]] + + userid = subargs.userid + if not userid: + userid = self.cfg.get('bonafide', 'active', default='') + self.data += ['export', userid, subargs.address[0]] return self._send(self._print_key) @@ -88,9 +96,13 @@ SUBCOMMANDS: help='email address of the key') subargs = parser.parse_args(raw_args) + userid = subargs.userid + if not userid: + userid = self.cfg.get('bonafide', 'active') + with open(subargs.file[0], 'r') as keyfile: rawkey = keyfile.read() - self.data += ['insert', subargs.uid, subargs.address[0], + self.data += ['insert', userid, subargs.address[0], subargs.validation, rawkey] return self._send(self._print_key) @@ -106,8 +118,12 @@ SUBCOMMANDS: parser.add_argument('address', nargs=1, help='email address of the key') subargs = parser.parse_args(raw_args) - self.data += ['delete', subargs.uid, subargs.address[0]] + userid = subargs.userid + if not userid: + userid = self.cfg.get('bonafide', 'active') + + self.data += ['delete', userid, subargs.address[0]] return self._send() def _print_key_list(self, keys): |