Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
lib/decidim
spec
Gemfile
Gemfile.lock
LICENSE
README.md
Rakefile
decidim-age_action_authorization.gemspec

README.md

Decidim::AgeActionAuthorization

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.

Installation

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

Usage

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'
end
You can’t perform that action at this time.