Added API support
This commit is contained in:
23
app/controllers/rabbitmq_controller.rb
Normal file
23
app/controllers/rabbitmq_controller.rb
Normal 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
|
@ -1,2 +1,4 @@
|
||||
# Plugin's routes
|
||||
# See: http://guides.rubyonrails.org/routing.html
|
||||
resources :rabbitmq
|
||||
match "rabbimq" => "rabbitmq#index",:via => [:get, :post]
|
||||
|
Reference in New Issue
Block a user