Projects:Unmark Development Modules in Production instances/Specs
Contents |
Functional Requirements
Goal
The objective of this project is to improve Openbravo's security and performance by avoiding that any installed modules in a production environment have the In development flag activated. Specifically, the cache implemented in ApplicationDictionaryCachedStructures requires to have all modules not in development mode.
This implies that once an instance is set as Production, all modules should have the In development flag unchecked, and administrators should not be able to mark them as In development in the Modules tab.
This goal can be achieved by the following actions:
- Once an instance is registered and set its purpose as "Production", all modules should be checked and unmark the "In development" ones. Registration can be done in the following ways:
- From the ERP as an admin user, General Setup | Application | Instance activation
- Using the task ant activate.instance
- You can also set the instance purpose directly using the Process "Instance Purpose Configuration"
- When the system starts, a process checks that there are no development modules and unchecks them if found.
- In the Module tab in edit view, it should not allow to save a module with the "In development" flag checked. It should show an error message instead.
Technical requirements
Implementation
In order to meet the functional requirements, a number of changes should be made:
- Once the instance is activated and set its purpose to "Production", all modules are set to not in development. This is made in ActiveInstanceProcess, which is a common process used both for the Activate Instance ERP form and the ant activate.instance task.
- Purpose can be changed as well in the System Info | Instance Purpose Activation button.
- Implement a trigger to prevent an administrator can set a module as in development either in the Module tab in ERP or making a query directly in the database.
- Created ProductionModuleInitializer class that runs when system is loading and checks that there are no in development modules if the instance purpose is set to Production.
Logic in all these places are centralized in ApplicationDictionaryCachedStructures. Once all modules are set to not in development, cache status is updated.