I am working on a user friendly interface that would allow different site
Managers or Admins to create and edit groups, assigning permissions and so
forth and noticed that only the auth tables (auth_user through auth_event)
get loaded into the drop down for field ('table_name') in the
db.auth_permissions table because I followed the suggestion in db.py to
create my tables under the section starting with:

## Define your tables below, for example...

I moved my table definitions above the section in db.py where the Auth class
is instantiated (and did not move anything else) and now they show up just
fine in the table_name (dropdown) list for auth_permission since the tables
exist when auth variable is set.

I have not had a chance to play much since figuring this out but I am
wondering about potential drawback as my tables are now defined before CRUD
but I have not been using web2py very long and am only playing with
authorization at the moment.

db.define_table('person',
    db.Field('name'))

db.define_table('dog',
    db.Field('name'),
    db.Field('owners', 'text'))

db.dog.owners.requires = IS_IN_DB(db,'person.id','%(name)s',multiple=True)

auth=Auth(globals(),db)                      # authentication/authorization
auth.settings.hmac_key='eee8b730-be5d-45f7-adbd-e5c2a9c467fb'
auth.define_tables()                         # creates all needed tables
crud=Crud(globals(),db)                      # for CRUD helpers using auth
service=Service(globals())                   # for json, xml, jsonrpc,
xmlrpc, amfrpc
and so on...

I found one other email related to this subject:

http://www.mail-archive.com/web2py@googlegroups.com/msg08485.html

If this creates problems, perhaps someone has a suggestion for another work
around. I could create a table of tables but that seems rather messy.

Any suggestions / comments would be welcomed.

Thanks,

Christopher Steel

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to