Class: DummyAuthorizationHandler
- Inherits:
-
Decidim::AuthorizationHandler
- Object
- Decidim::AuthorizationHandler
- DummyAuthorizationHandler
- Defined in:
- lib/decidim/generators/app_templates/dummy_authorization_handler.rb
Overview
An example authorization handler used so that users can be verified against third party systems.
You should probably rename this class and file to match your needs.
If you need a custom form to be rendered, you can create a file matching the class name named “_form”.
Example:
A handler named Decidim::CensusHandler would look for its partial in:
decidim/census/form
When testing your authorization handler, add this line to be sure it has a valid public api:
it_behaves_like "an authorization handler"
See Decidim::AuthorizationHandler for more documentation.
Defined Under Namespace
Classes: DummyActionAuthorizer
Instance Method Summary collapse
-
#metadata ⇒ Object
If you need to store any of the defined attributes in the authorization you can do it here.
-
#scope ⇒ Object
The user scope.
-
#unique_id ⇒ Object
If set, enforces the handler to validate the uniqueness of the field.
Instance Method Details
#metadata ⇒ Object
If you need to store any of the defined attributes in the authorization you can do it here.
You must return a Hash that will be serialized to the authorization when it is created, and available though authorization.metadata
71 72 73 |
# File 'lib/decidim/generators/app_templates/dummy_authorization_handler.rb', line 71 def super.merge(document_number:, postal_code:, scope_id:) end |
#scope ⇒ Object
The user scope
61 62 63 |
# File 'lib/decidim/generators/app_templates/dummy_authorization_handler.rb', line 61 def scope user.organization.scopes.find_by(id: scope_id) if scope_id end |
#unique_id ⇒ Object
If set, enforces the handler to validate the uniqueness of the field
55 56 57 |
# File 'lib/decidim/generators/app_templates/dummy_authorization_handler.rb', line 55 def unique_id document_number end |