The Ptah Management UI is a dashboard into your application. The Manage Interface is simple, extensible, and has quite a few features out of the box.
By default the Manage Interface is disabled.
managers sequence are login attributes from the
>> from ptah import auth_service >> print auth_service.get_current_principal().login >> firstname.lastname@example.org
The Manage Interface is configured through Ptah Settings. You will do this inside of your WSGI entry point where you return make_wsgi_app(). config is the Pyramid configurator.:
config.ptah_init_manage( managers = ['*'], disable_modules = ['rest', 'introspect', 'apps', 'permissions', 'settings'])
Inside of Ptah Settings you can set the managers argument the userid’s you want to allow access. * means everyone. By default it is empty and no one is allowed access. Granting everyone:
managers = ['*']
Granting a few people:
managers = ['email@example.com', 'firstname.lastname@example.org']
By default the Manage Interface is disabled. If Manage Interface is enabled but you want to prevent users from able to access it add the following to your .ini file:
ptah.manage = ""
The listing of modules you see when you open up http://localhost:6543/ptah-manage interface are all modules which your account has permission to view. Below are the out-of-the-box modules and a description.
A comprehensive view into all registrations in your application. It provides mechanisms to query URI’s, see events registered, subscribers, and you can jump directly to the source code where registration takes place.
A list of permission sets which are used by all applications running in the system.
Listing of all settings for Pyramid and Ptah. Ptah has extra settings features. This settings module will show more variables than the .ini file that you used to start Pyramid. These extra settings are from Ptah such as
Uses SQLAlchemy reflection capabilities to display all tables & rows that are accessible in the database. If a table is polymorphic it is not editable.
CRUD (CReate Update and Delete) interface for models. Displays a list of registered models, allows you to modify the records.
A list of all Ptah applications registered in the system.
A preview of most registered form Fields in the system. If a field does not provide a preview it will now show up. You can see how each field will be rendered.
The simplest module example to look at is in ptah/manage/rest.py which registers a template.
Create a class which subclasses ptah.manage.PtahModule. Decorate the class with
ptah.manage.module() decorate. The label you register using the manage.module decorator is the internal key for that module. If you wanted to disable it you would use this name in the ptah_settings[‘disable_modules’] registration.
import ptah @ptah.manage.module('rest') class RestModule(ptah.manage.PtahModule): """ REST Introspector """ title = 'REST Introspector'
The module views for the Manage Interface use traversal. It is important to note that you do not have to use ptah.View but you will need to use wrapper so your template will look like the rest of the Manage Interface. Here is an example, again, from the REST module:
from pyramid.view import view_config @view_config( context=RestModule, wrapper=ptah.wrap_layout(), renderer='ptah.manage:templates/rest.pt') class RestModuleView(ptah.View): def update(self): self.url = self.request.params.get('url','')
Nothing special. Just a Pyramid view with wrapper=ptah.wrap_layout() and you can do whatever you like in that view.