views:

31

answers:

1

I am tasked to rebuild four e-learning web applications (PHP MVC) that deal with companies and users that buy/sell and interact with online courses:

  1. The "overlord" application, where company accounts are created, reports are aggregated for all the accounts throughout all the other applications, etc.
  2. The "enterprise" application, where a larger organization manages it's children companies and has access to aggregated reports for all said companies.
  3. The eCommerce application, where companies and individuals buy and sell the courses.
  4. The "base" application, where a company's users get to interact with the courses created or bought by their company. Also here is where the users and courses are created, by "instructors", which are basically users with elevated management rights.

All of these applications have different interfaces of course, and are accessed on different domains.

As of this moment, application 4 is done.

My issue is that the previous developers duplicated a lot of code and only shared the database between applications, resulting in a maintenance mess when something needed to be changed.

The applications have a lot in common. They all deal with the same courses, users and companies, and going from 4 to 1, each application basically gets a bigger picture of what is happening.

For example, in application 4, there are course completion and eCommerce reports for the current company (which only some users can access). Going up to application 2, the reports for companies belonging to the same enterprise are aggregated, and further up, in application 1, the reports for all the enterprises and stand-alone companies are presented. Besides, each has some different piece of unique functionality.

So it seems natural to me that all the applications should share the same models, and each application should have it's own controllers and views. My questions are:

  1. What would be the best way to do this technically?. The applications are on the same server, each one in a different user's /home directory, and open_basedir restriction is in effect, with each application only being allowed to include files from it's directory.

  2. What are the security implications should I relax the open_basedir restrictions and allow the inclusion of files from the models' location? We own the server, so making any changes is not a problem (although running Plesk means that we should do every configuration from it's interface).

  3. How could I configure the domains?

  4. I now "it depends", but is this actually a good idea? I can see that there is a risk of overcrowding the models with functionality for all the applications (although I will surely separate applications logic where necessary).

A: 

If the applications are on the same server. i would make the a master account for one of those domains and park the rest of the domains on top of that. and have the application determine witch applications needs loading based on the domain.

Also you could go for this structure

-- public_html
-----index.php ( main app )
-----/domain2
---------index.php 
-----/domain3
---------index.php 
-----/domain4
---------index.php 

-- application ( folder for common code )
---- models

-- applications ( folder for app. specific code )
---- application1 
------- controllers
------- views

And you park the domains on the folders domain1, domain2 etc ... and in that index you could set the models, controllers and views path accordingly. This way you have a way of accessing the application with ought the domain ( for local, testing enviroments ).

solomongaby
Yes, that is basically the structure I thought of too, the only issues I have are with possible security problems by placing everything in one place. Should one user account be compromised, I am concerned about all the other apps.
Victor Stanciu
if the application will be able to read the models in a separate account so will the attacker that hacks that account.
solomongaby