Decidim File Authorization Handler
A plugin to add a csv based authorization handler to the Decidim platform
Allows admin users to upload a CSV file containing Document IDs and birthdates to a given organization. This information is used by a Decidim authorization handler to authorize real users.
This module provides a model
to store census information (identity document and birth date) in a hashed way
(real data is never stored).
It has an admin controller to upload CSV files with the information. When importing files all records are inserted and the duplicates are removed in a background job for performance reasons.
To keep the plugin simple the uploaded file is processed when the file is uploaded. Uploading the file to a temporary storage system and processing it in background is kept out of the scope for the first release.
CSV file format
The CSV file format is not configurable. The plugin expects a comma separated CSV with headers:
- ID_NUMBER: No format restrictions
The CSV separator can be overriden at installation level by using an initializer:
# config/initializers/file_authorization_handler.rb Decidim::FileAuthorizationHandler::CsvData.col_sep= ";"
Overriding Authorization Handler name
The authorization handler name is a default one not suitable for end users. Depending on the use case of the gem needs to be overriden accordingly.
Override the following keys to modify the name of the authorization handler and its description:
You can also override the name of the ID document and birthdate fields:
Add this line to your application's Gemfile:
And then execute:
bundle bin/rails decidim_file_authorization_handler:install:migrations bin/rails db:migrate
Finally, add the following line to your
mount Decidim::FileAuthorizationHandler::AdminEngine => '/admin'
Create a dummy app in your application (if not present):
And run tests:
If you find the following error after you have installed the engine:
undefined method 'decidim_file_authorization_handler_admin_path' for module#<Module:0x00007fa2aa4e2a10>
review if you have mounted the Engine routes into your application routes.
AGPLv3 (same as Decidim)