Browse Source

records simple API

pull/1/head
Nicolae Claudius 13 years ago
parent
commit
33788fb55e
  1. 11
      app/controllers/as_controller.rb
  2. 11
      app/controllers/records_controller.rb
  3. 6
      config/routes.rb

11
app/controllers/as_controller.rb

@ -12,17 +12,6 @@ class AsController < ApplicationController
conf.actions.exclude :show conf.actions.exclude :show
end end
before_filter :ensure_nested_under_domain, :except => 'modify' before_filter :ensure_nested_under_domain, :except => 'modify'
skip_before_filter :authenticate_user!, :only => 'modify'
protect_from_forgery :except => 'modify'
skip_authorize_resource :only => :modify
# TODO: externalize
def modify
@a = A.where(:authentication_token => params[:authentication_token]).first!
@a.content = params[:ip] || client_remote_ip
@a.save!
respond_with @a
end
protected protected

11
app/controllers/records_controller.rb

@ -25,4 +25,15 @@ class RecordsController < ApplicationController
conf.actions.exclude :show conf.actions.exclude :show
end end
before_filter :ensure_nested_under_domain before_filter :ensure_nested_under_domain
skip_before_filter :authenticate_user!, :only => 'modify'
protect_from_forgery :except => 'modify'
skip_authorize_resource :only => :modify
# TODO: externalize
def modify
@record = Record.where(:authentication_token => params[:authentication_token]).first!
@record.content = params[:ip] || client_remote_ip
@record.save!
respond_with @arecord
end
end end

6
config/routes.rb

@ -8,6 +8,9 @@ Entrydns::Application.routes.draw do
resources :records do resources :records do
as_routes as_routes
collection do
put 'modify/:authentication_token', :action => 'modify'
end
end end
resources :soas do resources :soas do
@ -24,9 +27,6 @@ Entrydns::Application.routes.draw do
resources :as do resources :as do
as_routes as_routes
collection do
put 'modify/:authentication_token', :action => 'modify'
end
end end
resources :cnames do resources :cnames do

Loading…
Cancel
Save