in reply to Re^2: Tracking records to change/insert during CGI
in thread Tracking records to change/insert during CGI

There's no reason that they couldn't alter the fieldname to be '900_foo' and '900_bar' and then submit the form.

So is there some column in the database indicating that the user owns 100 and 101 but not 900? What I do is always check that the user submitting the form has authority over the object/row he is trying to modify.

For example, if my primary object is a note, and note has columns id, created, updated, title, body, I'll have another table note_user that has columns note_id, user_id. If the user submits a form to edit note with id 100, I make sure there's a row in note_user with note_id 100 and user_id corresponding to the user, and if not I disallow the transaction.

This way I do not have to keep any data about the transaction in the session. My sessions are very thin, just id, user_id, created, updated.

In your case it sounds like you're trying to give users the freedom to create their own database table(s). Perhaps you can create a table_user map and update it whenever a user creates a new table. There could also be a row_user map for whenever a user creates a new row in a shared table. Then whenever the user tries to modify a particular row or table or insert to a particular table, you have a permissions table to check and make sure the transaction is OK.

  • Comment on Re^3: Tracking records to change/insert during CGI