On 8/30/06, Zarrabeitia <[EMAIL PROTECTED]> wrote:
> I wish to build a web interface to control the database. It should use
> identities, and groups and permissions (these tables can be created
> with tg-admin), but I don't know how to do it.

Install 0.9a9 and quickstart a new project (I strongly recommend
learning sqlalchemy and using the --sqlalchemy switch on quickstart
for this). When you get the identity prompt, answer yes. Modify the
user table to match your database schema. The only fields used in
identity seem to be user_id, user_name, and password. You can use the
``colname`` attribute in the ActiveMapper constructors to specify db
fieldnames explicitly.

> As an added difficulty, not all of the existing tables use an integer
> as a primary key (the users table, for instance, uses the username
> instead).

SQLObject can handle non-int primary keys, but it's not designed to do
so. This is why I recommend you use sqlalchemy. The identity framework
looks up names using a user_id. Normally this is an integer primary
key, but I don't see anywhere that enforces this. I'd therefore
structure your mapper so that user_id links to your pk column and
user_name is a created property (e.g. user_name =
property(get_name,set_name), the standard python property mechanism).

Once you get all that sorted out, you should BACK UP YOUR DATABASE and
tg-admin sql create all the new fields (the old ones shouldn't get
blown away... I think) and identity should work.

Hopefully this gets you started and people will correct any errors I've made. :]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to