diff options
Diffstat (limited to 'app/controllers/jira_connect/events_controller.rb')
-rw-r--r-- | app/controllers/jira_connect/events_controller.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/app/controllers/jira_connect/events_controller.rb b/app/controllers/jira_connect/events_controller.rb new file mode 100644 index 00000000000..8f79c82d847 --- /dev/null +++ b/app/controllers/jira_connect/events_controller.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class JiraConnect::EventsController < JiraConnect::ApplicationController + skip_before_action :verify_atlassian_jwt!, only: :installed + before_action :verify_qsh_claim!, only: :uninstalled + + def installed + installation = JiraConnectInstallation.new(install_params) + + if installation.save + head :ok + else + head :unprocessable_entity + end + end + + def uninstalled + if current_jira_installation.destroy + head :ok + else + head :unprocessable_entity + end + end + + private + + def install_params + params.permit(:clientKey, :sharedSecret, :baseUrl).transform_keys(&:underscore) + end +end |