summaryrefslogtreecommitdiffstats
path: root/ipawebui
diff options
context:
space:
mode:
Diffstat (limited to 'ipawebui')
-rw-r--r--ipawebui/__init__.py45
-rw-r--r--ipawebui/engine.py8
2 files changed, 35 insertions, 18 deletions
diff --git a/ipawebui/__init__.py b/ipawebui/__init__.py
index ba14438fd..9f86da344 100644
--- a/ipawebui/__init__.py
+++ b/ipawebui/__init__.py
@@ -20,6 +20,9 @@
IPA web UI.
"""
+from ipalib.backend import Executioner
+from ipalib.request import destroy_context
+from ipaserver.rpcserver import extract_query
from controllers import JSON
from engine import Engine
from widgets import create_widgets
@@ -34,20 +37,36 @@ def join_url(base, url):
return base + url
-def create_wsgi_app(api):
- baseurl = api.env.mount_ipa
- assets = Assets(
- url=join_url(baseurl, api.env.mount_webui_assets),
- dir=api.env.webui_assets_dir,
- prod=api.env.webui_prod,
- )
- app = Application(
- url=join_url(baseurl, api.env.mount_webui),
- assets=assets,
- widgets=create_widgets(),
- prod=api.env.webui_prod,
- )
+class WebUI(Application):
+ def __init__(self, api):
+ self.api = api
+ self.session = api.Backend.session
+ baseurl = api.env.mount_ipa
+ assets = Assets(
+ url=join_url(baseurl, api.env.mount_webui_assets),
+ dir=api.env.webui_assets_dir,
+ prod=api.env.webui_prod,
+ )
+ super(WebUI, self).__init__(
+ url=join_url(baseurl, api.env.mount_webui),
+ assets=assets,
+ widgets=create_widgets(),
+ prod=api.env.webui_prod,
+ )
+
+ def __call__(self, environ, start_response):
+ self.session.create_context(ccache=environ.get('KRB5CCNAME'))
+ try:
+ query = extract_query(environ)
+ print query
+ response = super(WebUI, self).__call__(environ, start_response)
+ finally:
+ destroy_context()
+ return response
+
+def create_wsgi_app(api):
+ app = WebUI(api)
engine = Engine(api, app)
engine.build()
diff --git a/ipawebui/engine.py b/ipawebui/engine.py
index a455c0e70..ea0905d49 100644
--- a/ipawebui/engine.py
+++ b/ipawebui/engine.py
@@ -86,16 +86,12 @@ class Engine(object):
)
def build(self):
- for cmd in self.api.Command():
+ for cmd in self.api.Object.user.methods():
self.pages[cmd.name] = self.build_page(cmd)
for page in self.pages.itervalues():
page.menu.label = 'Users'
self.add_object_menuitems(page.menu, 'user')
- menu = page.new('Menu', label='Groups')
- page.menuset.add(menu)
- self.add_object_menuitems(menu, 'group')
-
# Add in the info pages:
page = self.app.new('PageApp', id='api', title='api')
page.view.add(
@@ -143,6 +139,8 @@ class Engine(object):
table = self.app.new('FieldTable')
page.view.add(table)
for param in cmd.params():
+ if param.exclude and 'webui' in param.exclude:
+ continue
field = self.param_mapper(param, cmd)
table.add(field)