Class: Decidim::Verifications::WorkflowManifest
- Inherits:
-
Object
- Object
- Decidim::Verifications::WorkflowManifest
- Includes:
- ActiveModel::Model, AttributeObject::Model
- Defined in:
- lib/decidim/verifications/workflow_manifest.rb
Overview
This class serves as a DSL to declaratively specify a verification method.
To define a direct verification method, you need to specify the ‘form` attribute as a `Decidim::Form` that will be valid if the authorization is valid.
To define a deferred verification method, you need specify the ‘engine` attribute as a full `Rails::Engine` (and optionally another engine for the admin side as the `admin_engine` attribute). The verification will succeed once the engine creates a valid authorization for the method with the `granted_at` column set in DB.
Note that whereas direct methods can be used for “on the fly” verification, deferred methods require the authorization status to be persisted into DB. That is the reason why only direct methods can be used for user impersonation, for example, since they require continuous “on the fly” verification by the impersonating user.
Instance Method Summary collapse
- #action_authorizer_class ⇒ Object
- #description ⇒ Object
- #engine_or_form ⇒ Object
- #fullname ⇒ Object
-
#options {|@options| ... } ⇒ Object
Public: Adds configurable settings for this verification workflow.
- #type ⇒ Object
Instance Method Details
#action_authorizer_class ⇒ Object
65 66 67 68 69 70 71 |
# File 'lib/decidim/verifications/workflow_manifest.rb', line 65 def if .present? .constantize else DefaultActionAuthorizer end end |
#description ⇒ Object
61 62 63 |
# File 'lib/decidim/verifications/workflow_manifest.rb', line 61 def description "#{fullname} (#{I18n.t(type, scope: "decidim.authorization_handlers")})" end |
#engine_or_form ⇒ Object
47 48 49 |
# File 'lib/decidim/verifications/workflow_manifest.rb', line 47 def engine_or_form engine || form end |
#fullname ⇒ Object
57 58 59 |
# File 'lib/decidim/verifications/workflow_manifest.rb', line 57 def fullname I18n.t("#{key}.name", scope: "decidim.authorization_handlers", default: name.humanize) end |
#options {|@options| ... } ⇒ Object
Public: Adds configurable settings for this verification workflow. It uses the DSL specified under ‘Decidim::SettingsManifest`.
&block - The DSL present on ‘Decidim::SettingsManifest`
Examples:
workflow. do ||
.attribute :minimum_age, type: :integer, default: 18
end
Returns nothing.
85 86 87 88 89 90 91 |
# File 'lib/decidim/verifications/workflow_manifest.rb', line 85 def @options ||= SettingsManifest.new yield(@options) if block_given? @options end |
#type ⇒ Object
51 52 53 |
# File 'lib/decidim/verifications/workflow_manifest.rb', line 51 def type form ? "direct" : "multistep" end |