Sha256: 43df388dd4637d02658fc153f26ce4bc5a8378fd1a95b4e0962c4c569007fd43

Contents?: true

Size: 607 Bytes

Versions: 73

Compression:

Stored size: 607 Bytes

Contents

# frozen_string_literal: true

# An example implementation of an AuthorizationHandler to be used in tests.
class AnotherDummyAuthorizationHandler < Decidim::AuthorizationHandler
  attribute :passport_number, String
  attribute :postal_code, String

  validates :passport_number, presence: true
  validate :valid_passport_number

  def metadata
    super.merge(passport_number: passport_number, postal_code: postal_code)
  end

  def unique_id
    passport_number
  end

  private

  def valid_passport_number
    errors.add(:passport_number, :invalid) unless passport_number.to_s.start_with?("A")
  end
end

Version data entries

73 entries across 73 versions & 2 rubygems

Version Path
decidim-generators-0.26.2 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.26.1 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.26.0 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.26.0.rc2 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.26.0.rc1 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.25.2 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.25.1 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.25.0 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.25.0.rc4 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.25.0.rc3 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.25.0.rc2 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.25.0.rc1 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.24.3 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.23.6 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.24.2 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.23.5 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.24.1 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.24.0 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.24.0.rc2 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.23.4 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb