I am looking at trying to rewrite an application that is mostly procedural to an MVC/OO approach in order to teach myself a deeper understanding of both.
BUT, I am having some conceptual issues with the current group/access control that is used.
We have Groups (Businesses) that have role based users (Manager, salespersons, customers). They can have customers either assigned to a salesperson, or not. The manager sees everything, the salesperson only those customers assigned to him.
Business | ---Manager | ---Salespersons | ---Customers | ---Customers
The table structure for this currently is something like this:
users (userID [demographic info]) business (businessID, userID, et al [demographic info]) salespeople (salesID, businessID, userID [just foreign keys]) customers (customerID, businessID, userID, et al [demographic info]) salesAssignments (salesID, customerID [just foreign keys])
The Manager can affect everyone within that businesses group (everyone has a
businessID that links them to that business and no other). The customers can login and make minor changes to their profiles or interact via messaging to their salesperson or the businesses manager.
Added Spice to the mix: (comment on any of these if they apply to your insights to the above question) Is there a better way to have similar user access and control? I want to rebuild the site with an API that can be used by both the web app and mobile apps.
EDIT My main conceptual hangup at the moment relates to how to recreate this structure in a user object for the OO part of the application. Now everything is accessible via session variables, or queried from the DB via procedural functions. Again my understanding of OO is limited, and this is an attempt to figure it out.