Class: Decidim::DirectVerifications::UserProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/decidim/direct_verifications/user_processor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(organization, current_user, session, instrumenter) ⇒ UserProcessor

Returns a new instance of UserProcessor.



11
12
13
14
15
16
17
18
19
# File 'lib/decidim/direct_verifications/user_processor.rb', line 11

def initialize(organization, current_user, session, instrumenter)
  @organization = organization
  @current_user = current_user
  @authorization_handler = :direct_verifications

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

Instance Attribute Details

#authorization_handlerObject

Returns the value of attribute authorization_handler.



22
23
24
# File 'lib/decidim/direct_verifications/user_processor.rb', line 22

def authorization_handler
  @authorization_handler
end

#current_userObject (readonly)

Returns the value of attribute current_user.



21
22
23
# File 'lib/decidim/direct_verifications/user_processor.rb', line 21

def current_user
  @current_user
end

#emailsObject

Returns the value of attribute emails.



22
23
24
# File 'lib/decidim/direct_verifications/user_processor.rb', line 22

def emails
  @emails
end

#errorsObject (readonly)

Returns the value of attribute errors.



21
22
23
# File 'lib/decidim/direct_verifications/user_processor.rb', line 21

def errors
  @errors
end

#organizationObject (readonly)

Returns the value of attribute organization.



21
22
23
# File 'lib/decidim/direct_verifications/user_processor.rb', line 21

def organization
  @organization
end

#processedObject (readonly)

Returns the value of attribute processed.



21
22
23
# File 'lib/decidim/direct_verifications/user_processor.rb', line 21

def processed
  @processed
end

#sessionObject (readonly)

Returns the value of attribute session.



21
22
23
# File 'lib/decidim/direct_verifications/user_processor.rb', line 21

def session
  @session
end

Instance Method Details

#authorize_usersObject



30
31
32
33
34
# File 'lib/decidim/direct_verifications/user_processor.rb', line 30

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

#register_usersObject



24
25
26
27
28
# File 'lib/decidim/direct_verifications/user_processor.rb', line 24

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

#revoke_usersObject



36
37
38
39
40
# File 'lib/decidim/direct_verifications/user_processor.rb', line 36

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