Commit 56aa57ada338e2cfe5f5151b7e983e720a01d5b8
1 parent
e56e2fd3
Bug fixes on oauth_client plugin
- Changed oauth client configuration table name - Set automatic timestamp from login method for federated user Signed-off-by: Matheus Miranda <matheusmirandalacerda@gmail.com> Signed-off-by: Tallys Martins <tallysmartins@gmail.com>
Showing
6 changed files
with
20 additions
and
20 deletions
Show diff stats
plugins/oauth_client/controllers/oauth_client_plugin_admin_controller.rb
1 | class OauthClientPluginAdminController < AdminController | 1 | class OauthClientPluginAdminController < AdminController |
2 | 2 | ||
3 | def index | 3 | def index |
4 | - @config = OauthClientPlugin::Config.instance | 4 | + @config = OauthClientPlugin::Configuration.instance |
5 | end | 5 | end |
6 | 6 | ||
7 | def new | 7 | def new |
@@ -15,7 +15,7 @@ class OauthClientPluginAdminController < AdminController | @@ -15,7 +15,7 @@ class OauthClientPluginAdminController < AdminController | ||
15 | end | 15 | end |
16 | 16 | ||
17 | def update_configs | 17 | def update_configs |
18 | - OauthClientPlugin::Config.instance.update_attributes(params[:oauth_client_config]) | 18 | + OauthClientPlugin::Configuration.instance.update_attributes(params[:oauth_client_config]) |
19 | redirect_to :action => 'index' | 19 | redirect_to :action => 'index' |
20 | end | 20 | end |
21 | 21 |
plugins/oauth_client/db/migrate/20160714113820_create_oauth_client_plugin_config.rb
1 | class CreateOauthClientPluginConfig < ActiveRecord::Migration | 1 | class CreateOauthClientPluginConfig < ActiveRecord::Migration |
2 | 2 | ||
3 | def change | 3 | def change |
4 | - create_table :oauth_client_plugin_configs do |t| | 4 | + create_table :oauth_client_plugin_configurations do |t| |
5 | t.belongs_to :environment | 5 | t.belongs_to :environment |
6 | t.boolean :allow_external_login, :default => false | 6 | t.boolean :allow_external_login, :default => false |
7 | end | 7 | end |
plugins/oauth_client/lib/ext/environment.rb
1 | require_dependency 'environment' | 1 | require_dependency 'environment' |
2 | 2 | ||
3 | class Environment | 3 | class Environment |
4 | - has_one :oauth_client_plugin_configs, :class_name => 'OauthClientPlugin::Config' | 4 | + has_one :oauth_client_plugin_configuration, :class_name => 'OauthClientPlugin::Configuration' |
5 | has_many :oauth_providers, :class_name => 'OauthClientPlugin::Provider' | 5 | has_many :oauth_providers, :class_name => 'OauthClientPlugin::Provider' |
6 | end | 6 | end |
plugins/oauth_client/models/oauth_client_plugin/config.rb
@@ -1,15 +0,0 @@ | @@ -1,15 +0,0 @@ | ||
1 | -class OauthClientPlugin::Config < ApplicationRecord | ||
2 | - | ||
3 | - belongs_to :environment | ||
4 | - attr_accessible :allow_external_login, :environment_id | ||
5 | - | ||
6 | - class << self | ||
7 | - def instance | ||
8 | - environment = Environment.default | ||
9 | - environment.oauth_client_plugin_configs || create(environment_id: environment.id) | ||
10 | - end | ||
11 | - | ||
12 | - private :new | ||
13 | - end | ||
14 | - | ||
15 | -end |
plugins/oauth_client/models/oauth_client_plugin/configuration.rb
0 → 100644
@@ -0,0 +1,15 @@ | @@ -0,0 +1,15 @@ | ||
1 | +class OauthClientPlugin::Configuration < ApplicationRecord | ||
2 | + | ||
3 | + belongs_to :environment | ||
4 | + attr_accessible :allow_external_login, :environment_id | ||
5 | + | ||
6 | + class << self | ||
7 | + def instance | ||
8 | + environment = Environment.default | ||
9 | + environment.oauth_client_plugin_configuration || create(environment_id: environment.id) | ||
10 | + end | ||
11 | + | ||
12 | + private :new | ||
13 | + end | ||
14 | + | ||
15 | +end |
plugins/oauth_client/views/auth/_oauth_login.html.erb
@@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
5 | <div> | 5 | <div> |
6 | <%= render :partial => 'auth/generate_providers_links', :locals => {:providers => providers, :action => ""} %> | 6 | <%= render :partial => 'auth/generate_providers_links', :locals => {:providers => providers, :action => ""} %> |
7 | </div> | 7 | </div> |
8 | - <% if OauthClientPlugin::Config.instance.allow_external_login %> | 8 | + <% if OauthClientPlugin::Configuration.instance.allow_external_login %> |
9 | <%= _('Login with:') %> | 9 | <%= _('Login with:') %> |
10 | <div> | 10 | <div> |
11 | <%= render :partial => 'auth/generate_providers_links', :locals => {:providers => providers, :action => "external_login"} %> | 11 | <%= render :partial => 'auth/generate_providers_links', :locals => {:providers => providers, :action => "external_login"} %> |