Added API support

This commit is contained in:
Alexandr Antonov
2023-04-07 12:43:32 +03:00
parent 79b7ed86ef
commit ec77e4f07b
2 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,23 @@
class RabbitmqController < ApplicationController
layout 'admin'
before_action :require_admin
accept_api_auth :index
def index
if params[:rabbitmq_settings_set].present?
@plugin = Redmine::Plugin.find('rabbitmq')
hash_settings = Setting.plugin_rabbitmq
hash_settings
hash_settings[:rabbitmq_projects] << params[:rabbitmq_settings_set]
hash_settings[:rabbitmq_projects] = hash_settings[:rabbitmq_projects].uniq
Setting.send "plugin_rabbitmq=", hash_settings
render plain: hash_settings, status: 200
else
render plain: 'Add required parameters', status: 200
end
end
end

View File

@ -1,2 +1,4 @@
# Plugin's routes
# See: http://guides.rubyonrails.org/routing.html
resources :rabbitmq
match "rabbimq" => "rabbitmq#index",:via => [:get, :post]