Skip to content

Commit

Permalink
Support multiple verifiers at once.
Browse files Browse the repository at this point in the history
  • Loading branch information
tramuntanal committed Aug 3, 2023
1 parent 8bef055 commit 2c01853
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Version 0.2.0

- Support multiple verifiers (handlers) at once.

## Version 0.1.0

- Upgrade min Decidim version to v0.27.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,10 @@ def create_user
end

def create_or_update_authorization
handler= @form.verified_handler
handler.user = user
Authorization.create_or_update_from(handler)
@form.authorization_handlers.each do |handler|
handler.user = user
Authorization.create_or_update_from(handler)
end
end

def user_authorizations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,15 @@ def component
end
end

# Provides the handler that verified the user data to the command
def verified_handler
@verified_handler
end

# ----------------------------------------------------------------------
private
# ----------------------------------------------------------------------

# Check if the data introduced by the user verifies against any handler enabled for the current component.
# Check if the data introduced by the user verifies against all handlers enabled for the current component.
def verify_against_enabled_authorization_handlers
@verified_handler= authorization_handlers.find {|handler| handler.valid? }
invalid_handler= authorization_handlers.find {|handler| handler.invalid? }

errors.add(:authorizations, :invalid) unless @verified_handler
errors.add(:authorizations, :invalid) if invalid_handler
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/decidim/verify_wo_registration/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Decidim
# This holds the decidim-meetings version.
module VerifyWoRegistration
VERSION = '0.1.0'
VERSION = '0.2.0'
DECIDIM_VER = '>= 0.27'

def self.version
Expand Down

0 comments on commit 2c01853

Please sign in to comment.