Commit 074d20a94f8d3709e307236c28013643a0ca7a6d
1 parent
82b600ea
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
oauth_client: identifier attribute is no longer used
Showing
9 changed files
with
6 additions
and
20 deletions
Show diff stats
plugins/oauth_client/db/migrate/20141010135314_create_oauth_client_plugin_provider.rb
@@ -4,7 +4,6 @@ class CreateOauthClientPluginProvider < ActiveRecord::Migration | @@ -4,7 +4,6 @@ class CreateOauthClientPluginProvider < ActiveRecord::Migration | ||
4 | create_table :oauth_client_plugin_providers do |t| | 4 | create_table :oauth_client_plugin_providers do |t| |
5 | t.integer :environment_id | 5 | t.integer :environment_id |
6 | t.string :strategy | 6 | t.string :strategy |
7 | - t.string :identifier | ||
8 | t.string :name | 7 | t.string :name |
9 | t.text :options | 8 | t.text :options |
10 | t.boolean :enabled | 9 | t.boolean :enabled |
plugins/oauth_client/lib/oauth_client_plugin.rb
@@ -52,7 +52,6 @@ class OauthClientPlugin < Noosfero::Plugin | @@ -52,7 +52,6 @@ class OauthClientPlugin < Noosfero::Plugin | ||
52 | setup = lambda { |env| | 52 | setup = lambda { |env| |
53 | request = Rack::Request.new env | 53 | request = Rack::Request.new env |
54 | strategy = env['omniauth.strategy'] | 54 | strategy = env['omniauth.strategy'] |
55 | - identifier = request.path.split('/').last | ||
56 | 55 | ||
57 | domain = Domain.find_by_name(request.host) | 56 | domain = Domain.find_by_name(request.host) |
58 | environment = domain.environment rescue Environment.default | 57 | environment = domain.environment rescue Environment.default |
plugins/oauth_client/lib/oauth_client_plugin/provider.rb
@@ -2,8 +2,7 @@ class OauthClientPlugin::Provider < Noosfero::Plugin::ActiveRecord | @@ -2,8 +2,7 @@ class OauthClientPlugin::Provider < Noosfero::Plugin::ActiveRecord | ||
2 | 2 | ||
3 | belongs_to :environment | 3 | belongs_to :environment |
4 | 4 | ||
5 | - validates_presence_of :identifier, :name, :strategy | ||
6 | - validates_uniqueness_of :identifier, :scope => :environment_id | 5 | + validates_presence_of :name, :strategy |
7 | 6 | ||
8 | acts_as_having_image | 7 | acts_as_having_image |
9 | acts_as_having_settings :field => :options | 8 | acts_as_having_settings :field => :options |
@@ -12,7 +11,7 @@ class OauthClientPlugin::Provider < Noosfero::Plugin::ActiveRecord | @@ -12,7 +11,7 @@ class OauthClientPlugin::Provider < Noosfero::Plugin::ActiveRecord | ||
12 | settings_items :client_secret, :type => :string | 11 | settings_items :client_secret, :type => :string |
13 | settings_items :client_options, :type => Hash | 12 | settings_items :client_options, :type => Hash |
14 | 13 | ||
15 | - attr_accessible :identifier, :name, :environment, :strategy, :client_id, :client_secret, :enabled, :client_options, :image_builder | 14 | + attr_accessible :name, :environment, :strategy, :client_id, :client_secret, :enabled, :client_options, :image_builder |
16 | 15 | ||
17 | scope :enabled, :conditions => {:enabled => true} | 16 | scope :enabled, :conditions => {:enabled => true} |
18 | 17 |
plugins/oauth_client/test/functional/oauth_client_plugin_public_controller_test.rb
@@ -7,7 +7,7 @@ class OauthClientPluginPublicControllerTest < ActionController::TestCase | @@ -7,7 +7,7 @@ class OauthClientPluginPublicControllerTest < ActionController::TestCase | ||
7 | @auth.stubs(:info).returns(mock) | 7 | @auth.stubs(:info).returns(mock) |
8 | request.env["omniauth.auth"] = @auth | 8 | request.env["omniauth.auth"] = @auth |
9 | @environment = Environment.default | 9 | @environment = Environment.default |
10 | - @provider = OauthClientPlugin::Provider.create!(:name => 'provider', :strategy => 'provider', :identifier =>'provider', :enabled => true) | 10 | + @provider = OauthClientPlugin::Provider.create!(:name => 'provider', :strategy => 'provider', :enabled => true) |
11 | end | 11 | end |
12 | attr_reader :auth, :environment, :provider | 12 | attr_reader :auth, :environment, :provider |
13 | 13 |
plugins/oauth_client/test/unit/environment_test.rb
@@ -4,7 +4,7 @@ class UserTest < ActiveSupport::TestCase | @@ -4,7 +4,7 @@ class UserTest < ActiveSupport::TestCase | ||
4 | 4 | ||
5 | should 'be able to add oauth providers in a environment' do | 5 | should 'be able to add oauth providers in a environment' do |
6 | env = fast_create(Environment) | 6 | env = fast_create(Environment) |
7 | - env.oauth_providers << OauthClientPlugin::Provider.new(:name => 'test', :identifier => 'test', :strategy => 'test') | 7 | + env.oauth_providers << OauthClientPlugin::Provider.new(:name => 'test', :strategy => 'test') |
8 | end | 8 | end |
9 | 9 | ||
10 | end | 10 | end |
plugins/oauth_client/test/unit/oauth_client_plugin_test.rb
@@ -9,7 +9,7 @@ class OauthClientPluginTest < ActiveSupport::TestCase | @@ -9,7 +9,7 @@ class OauthClientPluginTest < ActiveSupport::TestCase | ||
9 | @environment = Environment.default | 9 | @environment = Environment.default |
10 | @session = {} | 10 | @session = {} |
11 | @request = mock | 11 | @request = mock |
12 | - @provider = OauthClientPlugin::Provider.create!(:name => 'name', :identifier => 'identifier', :strategy => 'strategy') | 12 | + @provider = OauthClientPlugin::Provider.create!(:name => 'name', :strategy => 'strategy') |
13 | end | 13 | end |
14 | 14 | ||
15 | attr_reader :params, :plugin, :environment, :session, :request, :provider | 15 | attr_reader :params, :plugin, :environment, :session, :request, :provider |
plugins/oauth_client/test/unit/user_test.rb
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../test_helper' | @@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../test_helper' | ||
3 | class UserTest < ActiveSupport::TestCase | 3 | class UserTest < ActiveSupport::TestCase |
4 | 4 | ||
5 | def setup | 5 | def setup |
6 | - @provider = OauthClientPlugin::Provider.create!(:name => 'name', :identifier => 'identifier', :strategy => 'strategy') | 6 | + @provider = OauthClientPlugin::Provider.create!(:name => 'name', :strategy => 'strategy') |
7 | end | 7 | end |
8 | attr_reader :provider | 8 | attr_reader :provider |
9 | 9 |
plugins/oauth_client/views/oauth_client_plugin_admin/edit.html.erb
@@ -17,15 +17,6 @@ | @@ -17,15 +17,6 @@ | ||
17 | </span> | 17 | </span> |
18 | </div> | 18 | </div> |
19 | 19 | ||
20 | - <div class="identifier"> | ||
21 | - <span class="label"> | ||
22 | - <%= _('Identifier') %> | ||
23 | - </span> | ||
24 | - <span class="value"> | ||
25 | - <%= f.text_field :identifier %> | ||
26 | - </span> | ||
27 | - </div> | ||
28 | - | ||
29 | <div class="strategy"> | 20 | <div class="strategy"> |
30 | <span class="label"> | 21 | <span class="label"> |
31 | <%= _('Strategy') %> | 22 | <%= _('Strategy') %> |
plugins/oauth_client/views/oauth_client_plugin_admin/index.html.erb
@@ -4,7 +4,6 @@ | @@ -4,7 +4,6 @@ | ||
4 | <table> | 4 | <table> |
5 | <tr> | 5 | <tr> |
6 | <th><%= _('Name') %></th> | 6 | <th><%= _('Name') %></th> |
7 | - <th><%= _('Identifier') %></th> | ||
8 | <th><%= _('Strategy') %></th> | 7 | <th><%= _('Strategy') %></th> |
9 | <th><%= _('Actions') %></th> | 8 | <th><%= _('Actions') %></th> |
10 | </tr> | 9 | </tr> |
@@ -12,7 +11,6 @@ | @@ -12,7 +11,6 @@ | ||
12 | <% environment.oauth_providers.each do |provider| %> | 11 | <% environment.oauth_providers.each do |provider| %> |
13 | <tr> | 12 | <tr> |
14 | <td><%= provider.name %></td> | 13 | <td><%= provider.name %></td> |
15 | - <td><%= provider.identifier %></td> | ||
16 | <td><%= provider.strategy %></td> | 14 | <td><%= provider.strategy %></td> |
17 | <td> | 15 | <td> |
18 | <%= link_to _('Edit'), {:action => 'edit', :id => provider.id} %> | 16 | <%= link_to _('Edit'), {:action => 'edit', :id => provider.id} %> |