Fix exposed functions
authorSimo Sorce <simo@redhat.com>
Tue, 7 Oct 2014 03:22:10 +0000 (23:22 -0400)
committerPatrick Uiterwijk <puiterwijk@redhat.com>
Tue, 7 Oct 2014 14:48:22 +0000 (16:48 +0200)
The Page util is supposed to intercept and enable exposed pages on
its own so that additional functions can be run in the generic __call__
Fix the code to check for the function argument correctly and use a
different argument than the standard cherrypy one for admin pages so
that we do actually land in the Page.__call__ all the time for those
pages.

Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
ipsilon/admin/info.py
ipsilon/admin/login.py
ipsilon/admin/providers.py
ipsilon/providers/saml2/admin.py
ipsilon/util/page.py

index 8e910c7..4a8aaba 100755 (executable)
@@ -128,7 +128,7 @@ class InfoPlugins(Page):
             obj.enable(self._site)
             msg = "Plugin %s enabled" % obj.name
         return self.root_with_msg(msg, "success")
-    enable.exposed = True
+    enable.public_function = True
 
     @admin_protect
     def disable(self, plugin):
@@ -142,4 +142,4 @@ class InfoPlugins(Page):
             obj.disable(self._site)
             msg = "Plugin %s disabled" % obj.name
         return self.root_with_msg(msg, "success")
-    disable.exposed = True
+    disable.public_function = True
index 16489f1..165b4ab 100755 (executable)
@@ -161,7 +161,7 @@ class LoginPlugins(Page):
             save_enabled_plugins(list(x.name for x in plugins['enabled']))
             msg = "Plugin %s enabled" % obj.name
         return self.root_with_msg(msg, "success")
-    enable.exposed = True
+    enable.public_function = True
 
     @admin_protect
     def disable(self, plugin):
@@ -176,4 +176,4 @@ class LoginPlugins(Page):
             save_enabled_plugins(list(x.name for x in plugins['enabled']))
             msg = "Plugin %s disabled" % obj.name
         return self.root_with_msg(msg, "success")
-    disable.exposed = True
+    disable.public_function = True
index 8219880..31e11ef 100755 (executable)
@@ -73,7 +73,7 @@ class ProviderPlugins(Page):
             obj.enable(self._site)
             msg = "Plugin %s enabled" % obj.name
         return self.root_with_msg(msg, "success")
-    enable.exposed = True
+    enable.public_function = True
 
     @admin_protect
     def disable(self, plugin):
@@ -87,4 +87,4 @@ class ProviderPlugins(Page):
             obj.disable(self._site)
             msg = "Plugin %s disabled" % obj.name
         return self.root_with_msg(msg, "success")
-    disable.exposed = True
+    disable.public_function = True
index b8c8223..7e14312 100755 (executable)
@@ -274,7 +274,7 @@ class SPAdminPage(Page):
         self.parent.del_sp(self.sp.name)
         self.sp.permanently_delete()
         return self.parent.root()
-    delete.exposed = True
+    delete.public_function = True
 
 
 class AdminPage(Page):
index aa075de..1548d47 100755 (executable)
@@ -66,7 +66,7 @@ class Page(Log):
 
         if len(args) > 0:
             op = getattr(self, args[0], None)
-            if callable(op) and getattr(self, args[0]+'.exposed', None):
+            if callable(op) and getattr(op, 'public_function', None):
                 return op(*args[1:], **kwargs)
         else:
             if self._is_form_page: