From 8589bd13c7aa9054dc27d8b3be5ede9ebffb6abe Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Thu, 29 Sep 2016 11:45:24 -0500 Subject: [feat] list active users - Resolves: 8488 --- src/leap/bitmask/bonafide/_protocol.py | 7 +++++++ src/leap/bitmask/bonafide/service.py | 3 +++ 2 files changed, 10 insertions(+) (limited to 'src/leap/bitmask/bonafide') diff --git a/src/leap/bitmask/bonafide/_protocol.py b/src/leap/bitmask/bonafide/_protocol.py index 7917f383..01919c7d 100644 --- a/src/leap/bitmask/bonafide/_protocol.py +++ b/src/leap/bitmask/bonafide/_protocol.py @@ -147,6 +147,13 @@ class BonafideProtocol(object): d.addCallback(lambda _: '%s logged out' % full_id) return d + def do_list_users(self): + users = [] + for user, session in self._sessions.items(): + users.append({'userid': user, + 'authenticated': session.is_authenticated}) + return users + def do_change_password(self, full_id, current_password, new_password): log.msg('Change password for %s' % full_id) if (full_id not in self._sessions or diff --git a/src/leap/bitmask/bonafide/service.py b/src/leap/bitmask/bonafide/service.py index 1f0d6362..fbe6846e 100644 --- a/src/leap/bitmask/bonafide/service.py +++ b/src/leap/bitmask/bonafide/service.py @@ -106,6 +106,9 @@ class BonafideService(HookableService): d.addCallback(lambda response: {'logout': 'ok'}) return d + def do_list_users(self): + return self._bonafide.do_list_users() + def do_change_password(self, username, current_password, new_password): def notify_passphrase_change(_): data = dict(username=username, password=new_password) -- cgit v1.2.3