Commit eaf2a1d5 by source_reader

removed unused code

parent c087a93c
......@@ -5,8 +5,8 @@ class DataAppController < ApplicationController
@app = DataApp.find(params[:id])
@nilm = @app.nilm
head :unauthorized and return unless current_user.views_nilm?(@nilm)
# destroy any existing tokens
InterfaceAuthToken.where(user: current_user, data_app: @app).destroy_all
token = InterfaceAuthToken.create(data_app: @app,
user: current_user, expiration: 5.minutes.from_now)
@auth_url = _app_auth_url(token)
......@@ -21,13 +21,4 @@ class DataAppController < ApplicationController
"#{base}/#{token.data_app.id}/?auth_token=#{token.value}"
end
def authenticate_interface_user
@current_user = User.find_by_id(session[:user_id])
@app = DataApp.find_by_id(session[:interface_id])
if @current_user.nil? || @app.nil?
return false
end
true
end
end
......@@ -26,12 +26,6 @@ class NilmsController < ApplicationController
else
@service = StubService.new
end
# url's for data apps
@apps_available = request.headers.key?("HTTP_X_APP_BASE_URI")
if @apps_available
@base_url = request.headers["HTTP_X_APP_BASE_URI"]
end
end
# POST /nilms.json
......
......@@ -13,16 +13,11 @@ json.data do
end
end
end
if @apps_available
json.data_apps(@nilm.data_apps) do |app|
json.id app.id
json.name app.name
json.url "#{@base_url}/#{app.id}/"
json.nilm_id @nilm.id
end
else
json.data_apps = []
json.data_apps(@nilm.data_apps) do |app|
json.id app.id
json.name app.name
json.url "" # this can be retrieved with data_app#show
json.nilm_id @nilm.id
end
end
json.partial! 'helpers/messages', service: @service
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment