From 3a81575a4625576895958c9a21c8b6c64307fcb9 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Wed, 15 Oct 2014 20:04:14 -0400 Subject: Reuse the AdminPlugins class for the providers too This way we can remove even more duplicated code... \o/ Signed-off-by: Simo Sorce Reviewed-by: Patrick Uiterwijk --- ipsilon/login/common.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'ipsilon/login') diff --git a/ipsilon/login/common.py b/ipsilon/login/common.py index 6cd1ca8..73422ae 100755 --- a/ipsilon/login/common.py +++ b/ipsilon/login/common.py @@ -34,6 +34,7 @@ class LoginManagerBase(PluginObject, Log): def __init__(self): super(LoginManagerBase, self).__init__() + self._site = None self.path = '/' self.next_login = None self.info = None @@ -115,7 +116,14 @@ class LoginManagerBase(PluginObject, Log): def get_tree(self, site): raise NotImplementedError + @property + def is_enabled(self): + if self._site: + return self in self._site[FACILITY]['enabled'] + return False + def enable(self, site): + self._site = site plugins = site[FACILITY] if self in plugins['enabled']: return @@ -147,6 +155,7 @@ class LoginManagerBase(PluginObject, Log): self.info = root.info def disable(self, site): + self._site = site plugins = site[FACILITY] if self not in plugins['enabled']: return -- cgit