I am nearly done with a web app in PHP, my first. I have setup a database to keep track of user acknowledgements of reviewing documents (MySQL). I have 4 levels of users: Admins, Managers, Supervisors, and Users.
Admins can do anything. Supervisors can see their own acknowledgement records and those of the department they are in. Users can only see their own acknowledgement records.
My issue is now that they want a "Manager" level that is like a Supervisor because they can see their own records but also the records from MULTIPLE departments. The manager to department relationship is managed in a table called mgrdepts which holds MgrID (same as userid in a table called Users) and DeptID (The ID of the dept from the Departments table).
Currently, a list is displayed like this for Supervisors:
SELECT * FROM acks, users, files where users.deptid = '$currentdept' and users.manager IS NULL and users.adminuser IS NULL and users.supervisor IS NULL and acks.userid=users.userid and acks.fileid=files.fileid and acks.ackbit IS NULL
However now, I need to link in a list of not just the user (manager's) department, but also the departments he is linked to in the mgrdepts table.
Help me, Obi Wans. I wants to learn!