summaryrefslogtreecommitdiff
path: root/bonafide/src
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2016-02-25 20:02:58 -0400
committerKali Kaneko (leap communications) <kali@leap.se>2016-02-25 20:02:58 -0400
commit9cf90bdcb4469cbfea3265f2ade470e22b8d912f (patch)
tree67598cbce6170491bae6419279cee57696a43c89 /bonafide/src
parent30ac25cc88eba606c44984ef24395da652ab40ca (diff)
get active user
Diffstat (limited to 'bonafide/src')
-rw-r--r--bonafide/src/leap/bonafide/service.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/bonafide/src/leap/bonafide/service.py b/bonafide/src/leap/bonafide/service.py
index bdbf729a..25ae9dc2 100644
--- a/bonafide/src/leap/bonafide/service.py
+++ b/bonafide/src/leap/bonafide/service.py
@@ -52,6 +52,10 @@ class BonafideService(service.Service):
def get_sibling_service(self, kind):
return self.parent.getServiceNamed(kind)
+ def startService(self):
+ log.msg('Starting Bonafide Service')
+ super(BonafideService, self).startService()
+
# Commands
def do_authenticate(self, username, password):
@@ -99,7 +103,15 @@ class BonafideService(service.Service):
return d
def do_logout(self, username, password):
+ if not username:
+ username = self._active_user
+
+ def reset_active(passthrough):
+ self._active_user = None
+ return passthrough
+
d = self._bonafide.do_logout(username, password)
+ d.addCallback(reset_active)
d.addCallback(lambda response: 'LOGOUT -> ok')
return d
@@ -113,3 +125,7 @@ class BonafideService(service.Service):
d = self._bonafide.do_get_smtp_cert(username)
d.addCallback(lambda response: (username, response))
return d
+
+ def do_get_active_user(self):
+ user = self._active_user
+ return user