Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
wattsworth
/
lumen-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
eaf2a1d5
authored
Sep 08, 2019
by
source_reader
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
removed unused code
parent
c087a93c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
23 deletions
app/controllers/data_app_controller.rb
app/controllers/nilms_controller.rb
app/views/nilms/show.json.jbuilder
app/controllers/data_app_controller.rb
View file @
eaf2a1d5
...
...
@@ -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
app/controllers/nilms_controller.rb
View file @
eaf2a1d5
...
...
@@ -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
...
...
app/views/nilms/show.json.jbuilder
View file @
eaf2a1d5
...
...
@@ -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.url "" # this can be retrieved with data_app#show
json.nilm_id @nilm.id
end
else
json.data_apps = []
end
end
json.partial! 'helpers/messages', service: @service
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment