Commit 21bcff06 by John Doe

working on interface controller

parent 4f5e0f72
......@@ -72,7 +72,7 @@ end
group :development do
gem 'guard-rubocop'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
gem 'web-console'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
......
......@@ -38,98 +38,102 @@ GEM
i18n (~> 0.7)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.5.1)
public_suffix (~> 2.0, >= 2.0.2)
airbrussh (1.2.0)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
airbrussh (1.3.0)
sshkit (>= 1.6.1, != 1.7.0)
arel (8.0.0)
ast (2.3.0)
ast (2.4.0)
backports (3.11.3)
bcrypt (3.1.11)
bcrypt (3.1.11-x64-mingw32)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
bindex (0.5.0)
builder (3.2.3)
byebug (9.0.6)
capistrano (3.8.1)
byebug (10.0.2)
capistrano (3.10.2)
airbrussh (>= 1.0.0)
i18n
rake (>= 10.0.0)
sshkit (>= 1.9.0)
capistrano-bundler (1.2.0)
capistrano-bundler (1.3.0)
capistrano (~> 3.1)
sshkit (~> 1.2)
capistrano-passenger (0.2.0)
capistrano (~> 3.0)
capistrano-rails (1.2.3)
capistrano-rails (1.3.1)
capistrano (~> 3.1)
capistrano-bundler (~> 1.1)
capistrano-rbenv (2.1.1)
capistrano-rbenv (2.1.3)
capistrano (~> 3.1)
sshkit (~> 1.3)
capybara (2.14.0)
capybara (3.0.3)
addressable
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
coderay (1.1.1)
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
xpath (~> 3.0)
coderay (1.1.2)
concurrent-ruby (1.0.5)
crack (0.4.3)
safe_yaml (~> 1.0.0)
crass (1.0.3)
cucumber (2.4.0)
crass (1.0.4)
cucumber (3.1.0)
builder (>= 2.1.2)
cucumber-core (~> 1.5.0)
cucumber-core (~> 3.1.0)
cucumber-expressions (~> 5.0.4)
cucumber-wire (~> 0.0.1)
diff-lcs (>= 1.1.3)
gherkin (~> 4.0)
diff-lcs (~> 1.3)
gherkin (~> 5.0)
multi_json (>= 1.7.5, < 2.0)
multi_test (>= 0.1.2)
cucumber-core (1.5.0)
gherkin (~> 4.0)
cucumber-rails (1.5.0)
capybara (>= 1.1.2, < 3)
cucumber (>= 1.3.8, < 4)
cucumber-core (3.1.0)
backports (>= 3.8.0)
cucumber-tag_expressions (~> 1.1.0)
gherkin (>= 5.0.0)
cucumber-expressions (5.0.17)
cucumber-rails (1.6.0)
capybara (>= 1.1.2, < 4)
cucumber (>= 3.0.2, < 4)
mime-types (>= 1.17, < 4)
nokogiri (~> 1.5)
railties (>= 4, < 5.2)
nokogiri (~> 1.8)
railties (>= 4, < 6)
cucumber-tag_expressions (1.1.1)
cucumber-wire (0.0.1)
database_cleaner (1.6.1)
debug_inspector (0.0.3)
devise (4.3.0)
database_cleaner (1.7.0)
devise (4.4.3)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0, < 5.2)
railties (>= 4.1.0, < 6.0)
responders
warden (~> 1.2.3)
devise_invitable (1.7.2)
devise_invitable (1.7.4)
actionmailer (>= 4.1.0)
devise (>= 4.0.0)
devise_token_auth (0.1.42)
devise (> 3.5.2, <= 4.3)
devise_token_auth (0.1.43)
devise (> 3.5.2, < 4.5)
rails (< 6)
diff-lcs (1.3)
docile (1.1.5)
erubi (1.7.0)
docile (1.3.0)
erubi (1.7.1)
execjs (2.7.0)
factory_girl (4.8.0)
factory_girl (4.9.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.8.0)
factory_girl (~> 4.8.0)
factory_girl_rails (4.9.0)
factory_girl (~> 4.9.0)
railties (>= 3.0.0)
faker (1.7.3)
i18n (~> 0.5)
ffi (1.9.18)
ffi (1.9.18-x64-mingw32)
faker (1.8.7)
i18n (>= 0.7)
ffi (1.9.23)
ffi (1.9.23-x64-mingw32)
formatador (0.2.5)
gherkin (4.1.3)
gherkin (5.0.0)
globalid (0.4.1)
activesupport (>= 4.2.0)
guard (2.14.1)
guard (2.14.2)
formatador (>= 0.2.4)
listen (>= 2.7, < 4.0)
lumberjack (~> 1.0)
lumberjack (>= 1.0.12, < 2.0)
nenv (~> 0.1)
notiffany (~> 0.0)
pry (>= 0.9.12)
......@@ -140,19 +144,19 @@ GEM
guard (~> 2.1)
guard-compat (~> 1.1)
rspec (>= 2.99.0, < 4.0)
guard-rubocop (1.2.0)
guard-rubocop (1.3.0)
guard (~> 2.0)
rubocop (~> 0.20)
hashdiff (0.3.4)
hashie (3.5.5)
httparty (0.15.5)
hashdiff (0.3.7)
hashie (3.5.7)
httparty (0.16.2)
multi_xml (>= 0.5.2)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
jbuilder (2.6.4)
activesupport (>= 3.0.0)
jbuilder (2.7.0)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
jquery-rails (4.3.1)
jquery-rails (4.3.3)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
......@@ -161,28 +165,28 @@ GEM
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
loofah (2.2.0)
loofah (2.2.2)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
lumberjack (1.0.12)
lumberjack (1.0.13)
mail (2.7.0)
mini_mime (>= 0.1.1)
method_source (0.8.2)
method_source (0.9.0)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_magick (4.7.2)
mini_magick (4.8.0)
mini_mime (1.0.0)
mini_portile2 (2.3.0)
minitest (5.11.3)
multi_json (1.12.1)
multi_json (1.13.1)
multi_test (0.1.2)
multi_xml (0.6.0)
nenv (0.3.0)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-ssh (4.1.0)
nio4r (2.2.0)
net-ssh (4.2.0)
nio4r (2.3.1)
nokogiri (1.8.2)
mini_portile2 (~> 2.3.0)
nokogiri (1.8.2-x64-mingw32)
......@@ -190,24 +194,24 @@ GEM
notiffany (0.1.1)
nenv (~> 0.1)
shellany (~> 0.0)
oj (3.0.9)
omniauth (1.6.1)
oj (3.6.0)
omniauth (1.8.1)
hashie (>= 3.4.6, < 3.6.0)
rack (>= 1.6.2, < 3)
orm_adapter (0.5.0)
parser (2.4.0.0)
ast (~> 2.2)
pg (0.21.0)
pg (0.21.0-x64-mingw32)
parallel (1.12.1)
parser (2.5.1.0)
ast (~> 2.4.0)
pg (1.0.0)
pg (1.0.0-x64-mingw32)
powerpack (0.1.1)
pry (0.10.4)
pry (0.11.3)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
public_suffix (2.0.5)
rack (2.0.4)
rack-cors (0.4.1)
rack-test (0.8.2)
method_source (~> 0.9.0)
public_suffix (3.0.2)
rack (2.0.5)
rack-cors (1.0.2)
rack-test (1.0.0)
rack (>= 1.0, < 3)
rails (5.1.5)
actioncable (= 5.1.5)
......@@ -224,57 +228,61 @@ GEM
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
railties (5.1.5)
actionpack (= 5.1.5)
activesupport (= 5.1.5)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (2.2.2)
rake
rake (12.3.0)
rb-fsevent (0.9.8)
rb-inotify (0.9.8)
ffi (>= 0.5.0)
rainbow (3.0.0)
rake (12.3.1)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
rdoc (4.3.0)
responders (2.4.0)
actionpack (>= 4.2.0, < 5.3)
railties (>= 4.2.0, < 5.3)
rspec (3.6.0)
rspec-core (~> 3.6.0)
rspec-expectations (~> 3.6.0)
rspec-mocks (~> 3.6.0)
rspec-core (3.6.0)
rspec-support (~> 3.6.0)
rspec-expectations (3.6.0)
rspec (3.7.0)
rspec-core (~> 3.7.0)
rspec-expectations (~> 3.7.0)
rspec-mocks (~> 3.7.0)
rspec-core (3.7.1)
rspec-support (~> 3.7.0)
rspec-expectations (3.7.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.6.0)
rspec-support (~> 3.7.0)
rspec-json_expectations (2.1.0)
rspec-mocks (3.6.0)
rspec-mocks (3.7.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.6.0)
rspec-rails (3.6.0)
rspec-support (~> 3.7.0)
rspec-rails (3.7.2)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 3.6.0)
rspec-expectations (~> 3.6.0)
rspec-mocks (~> 3.6.0)
rspec-support (~> 3.6.0)
rspec-support (3.6.0)
rubocop (0.48.1)
parser (>= 2.3.3.1, < 3.0)
rspec-core (~> 3.7.0)
rspec-expectations (~> 3.7.0)
rspec-mocks (~> 3.7.0)
rspec-support (~> 3.7.0)
rspec-support (3.7.1)
rubocop (0.55.0)
parallel (~> 1.10)
parser (>= 2.5)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.8.1)
ruby-progressbar (1.9.0)
ruby_dep (1.5.0)
safe_yaml (1.0.4)
sass (3.4.24)
sass-rails (5.0.6)
sass (3.5.6)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sass-rails (5.0.7)
railties (>= 4.0.0, < 6)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
......@@ -284,13 +292,12 @@ GEM
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
shellany (0.0.1)
simplecov (0.14.1)
docile (~> 1.1.0)
simplecov (0.16.1)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.1)
slop (3.6.0)
spring (2.0.1)
simplecov-html (0.10.2)
spring (2.0.2)
activesupport (>= 4.2)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
......@@ -303,41 +310,41 @@ GEM
sprockets (>= 3.0.0)
sqlite3 (1.3.13)
sqlite3 (1.3.13-x64-mingw32)
sshkit (1.13.1)
sshkit (1.16.0)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
terminal-notifier (1.8.0)
terminal-notifier (2.0.0)
terminal-notifier-guard (1.7.0)
thor (0.20.0)
thread_safe (0.3.6)
tilt (2.0.7)
turbolinks (5.0.1)
turbolinks-source (~> 5)
turbolinks-source (5.0.3)
tilt (2.0.8)
turbolinks (5.1.1)
turbolinks-source (~> 5.1)
turbolinks-source (5.1.0)
tzinfo (1.2.5)
thread_safe (~> 0.1)
tzinfo-data (1.2017.2)
tzinfo-data (1.2018.5)
tzinfo (>= 1.0.0)
uglifier (3.2.0)
uglifier (4.1.10)
execjs (>= 0.3.0, < 3)
unicode-display_width (1.2.1)
vcr (3.0.3)
unicode-display_width (1.3.2)
vcr (4.0.0)
warden (1.2.7)
rack (>= 1.0)
web-console (2.3.0)
activemodel (>= 4.0)
binding_of_caller (>= 0.7.2)
railties (>= 4.0)
sprockets-rails (>= 2.0, < 4.0)
webmock (3.0.1)
web-console (3.6.2)
actionview (>= 5.0)
activemodel (>= 5.0)
bindex (>= 0.4.0)
railties (>= 5.0)
webmock (3.4.1)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
websocket-driver (0.6.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
xpath (2.0.0)
nokogiri (~> 1.3)
xpath (3.0.0)
nokogiri (~> 1.8)
PLATFORMS
ruby
......@@ -382,7 +389,7 @@ DEPENDENCIES
tzinfo-data
uglifier (>= 1.3.0)
vcr
web-console (~> 2.0)
web-console
webmock
BUNDLED WITH
......
class InterfacesController < ActionController::Base
before_action :authenticate_interface_user!, except: [:authenticate]
#GET /authenticate
def authenticate
token = InterfaceAuthToken.find(params[:token])
#check if token timestamp is valid
puts("this session is: #{session[:test]}")
#sign_in(User.first)
reset_session
session[:user_id]=token.user.id
session[:interface_id]=token.joule_module.id
#interface_user_session(interface: token.interface.id)
#redirect '/'
end
#GET /logout
def logout
interface_user_sign_out
end
#everything else is proxied
private
def authenticate_interface_user!
puts 'authenticating...'
end
end
class InterfaceAuthToken < ApplicationRecord
end
......@@ -31,6 +31,9 @@ module ControlPanel
# Middleware like session, flash, cookies can be added back manually.
# Skip views, helpers and assets when generating a new resource.
config.api_only = true
# but still support cookies for interfaces
config.middleware.use ActionDispatch::Cookies
config.middleware.use ActionDispatch::Session::CookieStore
# Add folders under the services and adapters directory
%w(data nilm db db_folder db_stream permission user_group user data_view joule_modules).each do |service|
config.autoload_paths << Rails.root.join("app/services/#{service}")
......
......@@ -44,4 +44,6 @@ Rails.application.routes.draw do
put 'invite_user'
end
end
get 'interfaces/authenticate', to: 'interfaces#authenticate'
end
class CreateInterfaceAuthTokens < ActiveRecord::Migration[5.1]
def change
create_table :interface_auth_tokens do |t|
t.timestamps
end
end
end
require 'rails_helper'
RSpec.describe InterfacesController, type: :controller do
end
FactoryGirl.define do
factory :interface_auth_token do
end
end
require 'rails_helper'
RSpec.describe InterfaceAuthToken, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end
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