views:

98

answers:

1

I'm a noob, development wise and logistically-wise.

I'm developing a site that lets people take a test...

My client wants the ability for a user with the roll/privledge "admin" (a step below a super-admin) to be allowed to create users and only see/edit the users that they create...

The users created in that "category" or group need some information that their superior provides.

For example, I log in as a "manager", I have the ability to invite people to take the test, and manage those people. Before adding those people, I will have filled out a short survey about myself...

Right now, the users that are invited will be asked some of the same questions as the manager. I'd like to cut down the redundancy by using the information put into the database by the manager and apply it to the invited users.

How do I set up my database to work with this criterion? I'm a little confused about how to do this! Let me know if I can add more details...

(This is a mysql and php app)

A: 

I am sure there are several ways to do this but here is one that comes to mind.

In the "users" database, I am sure you have a column to specify which manager is assigned to the user by some kind of user key. Well If this field has a value, then pull the info from that users (manager user) record.

Example:

table 'users'
key----name------managerid-----questionone------questiontwo----
1-------randy-----0------------------california----------c++--------------
2-------bob--------1------------------nevada------------------------------

Since record(key)1 has managerid == 0 then use questiontwo record to answer "Question 2". Since record(key)2 has managerid == 1 then pull questiontwo from record(key)1 and use that for answer to question two.

You could either insert this information into the record or use it from the manager record dynamically as needed, which thought the space is still being used in the database, would be helpful since manager data might be updated and you might not want to have to update all records with that share the managerid wheh info is changed.

Make sense?

RandyMorris
Let me make sure I understand:Basically, each user has a "manager id", or an id that identifies who created them?By doing this I can limit who the managers can see/not see, and pull the correct questions for the users who have matching manager ids?This is good!
Kevin Brown