Trunk now includes some new functionality in appadmin to allow specially 
designated administrative users of an app to manage specific tables in the 
database.

First, there is /appadmin/manage/auth, which is a special page specifically 
for managing Auth users, roles, and permissions. 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 (note, you cannot use 
"auth" as a key because it is already being used for the built-in 
/appadmin/manage/auth page, as described above).

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.

-- 

--- 
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.


Reply via email to