Sha256: a89753a5f783593a976816b25799ea491cdaec57dfaac48bb41b7cc8f594ddc7

Contents?: true

Size: 1.31 KB

Versions: 6

Compression:

Stored size: 1.31 KB

Contents

# frozen_string_literal: true

require "decidim/direct_verifications/register_user"
require "decidim/direct_verifications/authorize_user"
require "decidim/direct_verifications/revoke_user"
require "decidim/direct_verifications/instrumenter"

module Decidim
  module DirectVerifications
    class UserProcessor
      def initialize(organization, current_user, session, instrumenter)
        @organization = organization
        @current_user = current_user
        @authorization_handler = :direct_verifications

        @emails = {}
        @session = session
        @instrumenter = instrumenter
      end

      attr_reader :organization, :current_user, :session, :errors, :processed
      attr_accessor :authorization_handler, :emails

      def register_users
        emails.each do |email, data|
          RegisterUser.new(email, data, organization, current_user, instrumenter).call
        end
      end

      def authorize_users
        emails.each do |email, data|
          AuthorizeUser.new(email, data, session, organization, instrumenter, authorization_handler).call
        end
      end

      def revoke_users
        emails.each do |email, _name|
          RevokeUser.new(email, organization, instrumenter, authorization_handler).call
        end
      end

      private

      attr_reader :instrumenter
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-direct_verifications-1.2.1 lib/decidim/direct_verifications/user_processor.rb
decidim-direct_verifications-1.2 lib/decidim/direct_verifications/user_processor.rb
decidim-direct_verifications-1.0.2 lib/decidim/direct_verifications/user_processor.rb
decidim-direct_verifications-1.0.1 lib/decidim/direct_verifications/user_processor.rb
decidim-direct_verifications-1.1 lib/decidim/direct_verifications/user_processor.rb
decidim-direct_verifications-1.0 lib/decidim/direct_verifications/user_processor.rb