Class: Decidim::Verifications::DestroyUserAuthorization

Inherits:
Command
  • Object
show all
Defined in:
app/commands/decidim/verifications/destroy_user_authorization.rb

Overview

A command to Destroy the Authorization of a user.

Instance Method Summary collapse

Constructor Details

#initialize(authorization) ⇒ DestroyUserAuthorization

Returns a new instance of DestroyUserAuthorization.



7
8
9
# File 'app/commands/decidim/verifications/destroy_user_authorization.rb', line 7

def initialize(authorization)
  @authorization = authorization
end

Instance Method Details

#callObject



11
12
13
14
15
16
17
# File 'app/commands/decidim/verifications/destroy_user_authorization.rb', line 11

def call
  return broadcast(:invalid) unless authorization

  authorization.destroy!

  broadcast(:ok, authorization)
end