Added one more feature -- you can now pass any arbitrary arguments to smartgrid to control the display of some or all of the tables being managed. To do this, just include a "smartgrid_args" key in the dictionary of the manager action:
auth.settings.manager_actions = dict( things=dict( role='Thing Manager', heading='Manage Things', db=other_db, tables=['things', 'stuff', 'more_stuff'], smartgrid_args=dict( DEFAULT=dict(maxtextlength=50, paginate=30), things=dict(maxtextlength=100, orderby=~db.things.created_on), stuff=dict(editable=False, csv=False) ) ), ) smartgrid_args is a dictionary of dictionary. The top-level keys are the names of tables, and the dictionary associated with each key includes the arguments to be passed to .smartgrid (most of which get passed to .grid) for that table. One of the keys can also be "DEFAULT" -- those arguments are applied to all tables, unless explicitly overridden by the dictionary specific to the table being displayed. Anthony On Friday, June 14, 2013 5:36:03 PM UTC-4, Anthony wrote: > > One more thing -- you can override the default /appadmin/manage/auth by > providing an "auth" key in auth.settings.manager_actions with a custom dict > for that action (this makes it possible to specify a custom heading or > limit which Auth tables are included). In that case, you'll still get some > special Auth related customizations (re-labeling some columns and links to > more user-friendly labels, hiding ID columns, setting default sort order, > etc.) -- if you don't want those customizations and instead want complete > control, then just create a custom manager_action with a name other than > "auth". > > Anthony > > On Friday, June 14, 2013 12:13:17 PM UTC-4, Anthony wrote: >> >> Trunk now includes some new functionality in appadmin to allow specially >> designated administrative users of an app to manage specific tables in the >> database. >> >> >> <https://lh4.googleusercontent.com/-B1AhpU7hOFg/UbtG1BQ0I9I/AAAAAAAABf0/f4tl0Is3TN4/s1600/appadmin.png> >> >> First, there is /appadmin/manage/auth, which is a special page >> specifically for managing Auth users, roles, and permissions (see >> screenshot above). Just create an Auth group that is to be allowed access >> to this page and specify the "role" of that group in >> auth.settings.auth_manager_role. Then anyone assigned to that Auth group >> will have access to the page. >> >> You can also create any number of custom db management pages much like >> the /appadmin/manage/auth page via the new >> auth.settings.manager_actionssetting, which is a dict of dicts. An example >> looks like this: >> >> auth.settings.manager_actions = dict( >> db=dict(role='Admin', heading='Manage Database', tables=db.tables), >> things=dict(role='Thing Manager', heading='Manage Things', db= >> other_db, >> tables=['things', 'stuff', 'more_stuff']), >> content=dict(role='Content Manager', >> tables=[content_db.articles, content_db.recipes,content_db >> .comments]) >> ) >> >> The keys of the auth.settings.manager_actions dict are URL args that go >> after /appadmin/manage -- so the above allows /appadmin/manage/db, >> /appadmin/manage/things, and /appadmin/manage/content. >> >> Each item in auth.settings.manager_actions is a dict with "role", >> "heading", "tables", and "db" keys: >> >> - *role*: Specifies the "role" of the Auth group that should be >> allowed to access the page. >> - *heading*: Specifies the heading to appear on the page, though it >> is optional -- if there is no "heading", it will use 'Manage %s' % >> request.args(0).replace('_', ' ').title() instead. >> - *tables*: A list of DAL tables to include on the page. It can be >> either a list of table names or actual DAL table objects. >> - *db*: Specifies the DAL object that contains the tables to be >> managed (you can specify the DAL object itself, or its variable name, >> which >> will be looked up in globals()). The "db" key is optional -- if >> "tables" is a list of DAL table objects, the table objects themselves >> determine the db; and if "tables" is a list of table names, auth.db will >> be >> used if no "db" key is specified (auth.db is the database used for the >> Auth >> tables, which is typically the main app database). >> >> Note, access to these pages is controlled by the app's own Auth system, >> not by the "admin" app (as with the rest of appadmin). >> >> Try it out and let us know if you run into any problems. >> >> Anthony >> >> >> -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.