Sha256: 3bf5b06868b8259ab536a6328b15873aa65f7d49c35baf2075295efca57ee642

Contents?: true

Size: 579 Bytes

Versions: 13

Compression:

Stored size: 579 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:, 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

13 entries across 13 versions & 1 rubygems

Version Path
decidim-generators-0.29.1 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.28.4 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.29.0 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.28.3 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.29.0.rc4 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.29.0.rc3 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.29.0.rc2 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.29.0.rc1 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.28.2 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.28.1 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.28.0 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.28.0.rc5 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
decidim-generators-0.28.0.rc4 lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb