Original Post
It was interesting for me to see a thread on user permissions here, when I've been contemplating that same issue myself. (note: I thought of posting in the Web App Design: Storing Settings thread, but decided to create a new thread to avoid any potential hijacking.) Currently, my permissions system works like this: A user attempts to access an item of content in a particular way (either by viewing, adding, editing, or deleting). I compare the meta data about the content being accessed to the user's stored abilities to determine whether or not the action is allowed. The content meta data contains: type: e.g., news item, forum post, forum thread, etc permission hint(s): e.g., "Authorized Only", "Registered Member Only", etc The user abilities contains: power: how the content is being accessed (view, add, edit, delete) type: type of content permission hint set(s): a hint and flag denoting whether the hint is required, restricted, or optional. This allows for a great deal of flexibility - you can specify, for example, that a user can only view news items without permission hint authorized only. Or you could specify that a user can add news items, but all news items created must have permission hint member only associated with the item. Unfortunately, due to the complexity of this, I have to sort out whether or not a user can access content in PHP (opposed to sorting it out in an SQL query). For many things, like say accessing a single article, this isn't a problem. But if I were to pull up a list of one hundred or so news items, I have to go through each item one by one to determine whether or not a user has access. Although this hasn't been slow in the past, it has been very inconvenient - especially when I would like to, say, limit a query to the 5 most recent articles. If the first three happen to be articles that a particular user cannot view, only two will be displayed (even though there may be many more viewable articles in the database). My tables are set up like so (abilities, hints, and powers are merely two field tables containing an id and name): Generic Asset table for content: asset_id type_id Ability-Hint relation: ability_id, hint_id, flag (Required, Restricted) -- if the hint/ability relation is not present, that hint is optional (not required, not restricted) Ability-Power relation: ability_id, power_id Ability-Type relation: ability_id, type_id Ability-User relation: ability_id, user_id Asset-Hint relation: asset_id, hint_id A visual aid to help illustrate how a user and an asset come together in the database (note that power would most likely be a constant in the equation): 
So basically, the trouble I'm having is comparing the content hints to the user's ability hints in a query. Assuming the user can view/add/etc. the specificed type, he/she can proceed as long as his/her Required hints are associated with the content and his/her Restricted hints are not associated.
