View Single Post
Old 01-03-2008, 13:14   #13 (permalink)
Shiro
shiro
 
Shiro's Avatar
 
Join Date: Aug 2007
Location: Yokohama, Japan
Posts: 3,235
Quote:
Thanks! I'll try and figure it out first, then come back here after I've realized I don't know what the hell I'm doing

Back. Don't know what the hell I'm doing! I wish I even had some code to show, but I've been playing around with this for quite a while and have come up with nothing.

Here is the deal (simplified to the basics):

Table 1: Users (username, user_id)
Table 2: authorization(user_id, area, level)

'Users' is pretty self-explanatory I think - each user has one row that holds their username and ID. Authorization is a table that registers a user ID with an area of the site, and their authorization level within that area (mod or admin). Users will have one row for each area of the site for which they have an authorization level. ex:

user_id area authorization_level
1 A mod
1 B admin
1 C admin
2 A mod
3 A admin
3 D admin

Lets say I am logged in as user 1. What I want to do is get the username and user_id for users that have rows in any of the areas I (user1) have authorization for, but no users that have rows in areas that I DONT have authorization for.

In the above example, I am user 1 with authorization for areas A, B and C
The other users have authorization for the following areas:

User 2: area A
User 3: Area A, Area D

Since all of user 2's authorizations lie in areas that I (user1) have authorization for, I would want their username and ID to be pulled from the database. But since user 3 has authorization for an area I dont have authorization for (area D), then I don't want their info pulled out of the database, even though they also have permission for an area I have permission for.

To break it down, it basically comes down to this:

Get the username and ID for any users that have permissions that are equal to or less than my own.

There is of course more to this such as the authorization levels themselves, but I think I can figure that out myself after the fact.

Thanks to anyone who is willing to help me out on this!
  Reply With Quote