views:

104

answers:

1

Hello all,

I'm currently working on a small webapp where I work. I've created this for different departments. So, for example, let's say that: Marketing, Human Resources, and Sales uses it.

Right now, as it stands, I have 3 completely different directories for each dept:

 http://mydomain.com/hr
 http://mydomain.com/marketing
 http://mydomain.com/sales

And each directory (department) has it's own MySQL database, with it's tables.

I have a few questions so that I can hopefully create this more efficiently:

1) Sometimes, I will have a user who will have access to two or more of the departments. For example, a user might have access to both HR and Marketing. I do not want to have this user create 2 different accounts. How can I "tie" this into one database?

2) Also, if I have a user who has access to both "areas", what would be a good way to 'direct' that user to change between both departments?

3) Finally, regarding the different directories, is there a more efficient way to do this? Each directory is essentially the same exact code, just with minor changes.

This is something that I've never done, so some help on creating this the 'right' way would be great. Especially while it's small, if I eventually expand this out to other departments.

Thanks!

+1  A: 
  1. Your company, like every other probably has one place to store all of their employee information. You should apply the same principle on your web application, meaning you should have one central database for all employees with privilegies information so that you can define employee's access to each department.

  2. If you apply the above principle (one database for all users containing privilegies information) it should be pretty easy to redirect users to other departments if that is what you'r asking here.

  3. You should split your project into smaller pieces so that you can identify the core part of your project and share that part among all departments. There are many ways to accomplish this but copy-pasting your code for every department is not efficient and it will get in your way later on. Even with three departments it is tedious to copy-paste changes to each one. Also note that if you use separate databases for departments you wont be able to share data among them (at least not in a nice, elegant way).

What you should do is leave your programming language on side for a couple of hours/days and write some design documents about that project. It doesn't have to be too detailed, just enough so you can see how modular it will be and what you can and shouldn't do to make it more modular.

With that said, you should wait for more answers as I'm not as professional as others on SO :-) And excuse my bad english.

schmrz