GwDbValidator¶
This plugin automatically activates the validation of all database models, which are and will be registered via groundwork-database.
On activation GwDbValidator
fetches all existing database models and activates their validation by using
register()
of GwValidatorsPattern
.
It also registers a receiver to get notified, if a new database model is registered. If this is the case, it also registers a new validator for this new model.
Activation and Usage¶
All you have to do is to activate the plugin, which is done by adding its name to your application configuration:
LOAD_PLUGINS = ["MyDbPlugin", "MyOtherPlugin", "GwDbValidator"]
That’s it. From now on all important database actions get validated.
Configuration¶
GwDbValidator
is based on
DbValidatorsPlugin
and therefore needs the same Configuration.
You need to set the parameter HASH_DB, which defines the database to be used for storing hash values:
HASH_DB = "sqlite://%s/hash_db" % APP_PATH
Requirements & Specifications¶
The following sections describes the implemented requirements and their related specifications.
Available requirements
ID | Title | Type | Status | Links | Tags |
---|---|---|---|---|---|
R_002 | Validated read requests on database tables | Requirement | implemented | gwdbvalidator_plugin; | |
R_003 | Configuration only | Requirement | implemented | gwdbvalidator_plugin; | |
R_001 | Hashed write requests on database tables | Requirement | implemented | gwdbvalidator_plugin; |
Available specifications
ID | Title | Type | Status | Links | Tags |
---|---|---|---|---|---|
S_001 | Using of groundwork pattern GwDbValidatorPattern | Specification | implemented | R_001; R_002 | gwdbvalidator_plugin; |
S_002 | Automatic database table registration for validation | Specification | implemented | R_003 | gwdbvalidator_plugin; |
Requirements¶
Requirement: Hashed write requests on database tables (R_001)
As developer I want my write requests being hashed and available for later use.
status: implemented
tags: gwdbvalidator_plugin;
Requirement: Validated read requests on database tables (R_002)
As developer I want to be sure, that all read requests on database tables are validated based on a stored hash
status: implemented
tags: gwdbvalidator_plugin;
Requirement: Configuration only (R_003)
As developer I want to activate the validation of all database tables by configuration options only.
status: implemented
tags: gwdbvalidator_plugin;
Specification¶
Specification: Using of groundwork pattern GwDbValidatorPattern (S_001)
We are using the GwDbValidatorsPattern to implement Hashed write requests on database tables (R_001) und Validated read requests on database tables (R_002).
status: implemented
tags: gwdbvalidator_plugin;
Specification: Automatic database table registration for validation (S_002)
To easily activate validation of all registered database tables, the plugin needs to perform the following actions during activation:
- Request all already registered database tables and register a new db-validator for them
- Register a listener for the signal db_class_registered and register a new validator every time the signal is send and the newly registered database class is provided.
status: implemented
tags: gwdbvalidator_plugin;
links: R_003