A Decidim based action authorization to check user’s age inside actions. The Decidim Default Action Authorizer only allows comparing items that are equal to an expected value.

This authorization checks a metadata field named birthday in the AuthorizationHandler used and compares the value against a minimum age defined in the provided JSON for the action authorizer. The JSON field is named edad.

E.g: {"edad": 20 }.

By default the minimum age is 18 years old if no JSON is provided.


Add this line to your application’s Gemfile:

gem 'decidim-age_action_authorization'

And then execute:

$ bundle

Or install it yourself as:

$ gem install decidim-age_action_authorization


In the workflow configuration add the AgeActionAuthorization as the workflow’s action authorizer:

Decidim::Verifications.register_workflow(:authorization_handler) do |workflow|
  workflow.form = 'AuthorizationHandler'
  workflow.action_authorizer = 'Decidim::AgeActionAuthorization::Authorizer'