Sha256: 82a182a2efe43e32195cc381a4f8e89b8b064dd77f7bce03327300566e7eadd5

Contents?: true

Size: 949 Bytes

Versions: 25

Compression:

Stored size: 949 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module System
    # This command deals with destroying an application from the admin panel.
    class DestroyOAuthApplication < Decidim::Command
      # Public: Initializes the command.
      #
      # application - The OAuthApplication to be destroyed.
      # user        - The user that destroys the application.
      def initialize(application, current_user)
        @application = application
        @current_user = current_user
      end

      # Public: Executes the command.
      #
      # Broadcasts :ok if it got destroyed
      def call
        destroy_application
        broadcast(:ok)
      end

      private

      attr_reader :application, :current_user

      def destroy_application
        Decidim.traceability.perform_action!(
          "delete",
          application,
          current_user
        ) do
          application.destroy!
        end
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
decidim-system-0.27.2 app/commands/decidim/system/destroy_oauth_application.rb
decidim-system-0.27.1 app/commands/decidim/system/destroy_oauth_application.rb
decidim-system-0.27.0 app/commands/decidim/system/destroy_oauth_application.rb
decidim-system-0.27.0.rc2 app/commands/decidim/system/destroy_oauth_application.rb
decidim-system-0.27.0.rc1 app/commands/decidim/system/destroy_oauth_application.rb