Commit 074d20a94f8d3709e307236c28013643a0ca7a6d

Authored by Victor Costa
1 parent 82b600ea

oauth_client: identifier attribute is no longer used

plugins/oauth_client/db/migrate/20141010135314_create_oauth_client_plugin_provider.rb
... ... @@ -4,7 +4,6 @@ class CreateOauthClientPluginProvider < ActiveRecord::Migration
4 4 create_table :oauth_client_plugin_providers do |t|
5 5 t.integer :environment_id
6 6 t.string :strategy
7   - t.string :identifier
8 7 t.string :name
9 8 t.text :options
10 9 t.boolean :enabled
... ...
plugins/oauth_client/lib/oauth_client_plugin.rb
... ... @@ -52,7 +52,6 @@ class OauthClientPlugin < Noosfero::Plugin
52 52 setup = lambda { |env|
53 53 request = Rack::Request.new env
54 54 strategy = env['omniauth.strategy']
55   - identifier = request.path.split('/').last
56 55  
57 56 domain = Domain.find_by_name(request.host)
58 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 2  
3 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 7 acts_as_having_image
9 8 acts_as_having_settings :field => :options
... ... @@ -12,7 +11,7 @@ class OauthClientPlugin::Provider < Noosfero::Plugin::ActiveRecord
12 11 settings_items :client_secret, :type => :string
13 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 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 @auth.stubs(:info).returns(mock)
8 8 request.env["omniauth.auth"] = @auth
9 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 11 end
12 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 4  
5 5 should 'be able to add oauth providers in a environment' do
6 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 8 end
9 9  
10 10 end
... ...
plugins/oauth_client/test/unit/oauth_client_plugin_test.rb
... ... @@ -9,7 +9,7 @@ class OauthClientPluginTest &lt; ActiveSupport::TestCase
9 9 @environment = Environment.default
10 10 @session = {}
11 11 @request = mock
12   - @provider = OauthClientPlugin::Provider.create!(:name => 'name', :identifier => 'identifier', :strategy => 'strategy')
  12 + @provider = OauthClientPlugin::Provider.create!(:name => 'name', :strategy => 'strategy')
13 13 end
14 14  
15 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__) + &#39;/../test_helper&#39;
3 3 class UserTest < ActiveSupport::TestCase
4 4  
5 5 def setup
6   - @provider = OauthClientPlugin::Provider.create!(:name => 'name', :identifier => 'identifier', :strategy => 'strategy')
  6 + @provider = OauthClientPlugin::Provider.create!(:name => 'name', :strategy => 'strategy')
7 7 end
8 8 attr_reader :provider
9 9  
... ...
plugins/oauth_client/views/oauth_client_plugin_admin/edit.html.erb
... ... @@ -17,15 +17,6 @@
17 17 </span>
18 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 20 <div class="strategy">
30 21 <span class="label">
31 22 <%= _('Strategy') %>
... ...
plugins/oauth_client/views/oauth_client_plugin_admin/index.html.erb
... ... @@ -4,7 +4,6 @@
4 4 <table>
5 5 <tr>
6 6 <th><%= _('Name') %></th>
7   - <th><%= _('Identifier') %></th>
8 7 <th><%= _('Strategy') %></th>
9 8 <th><%= _('Actions') %></th>
10 9 </tr>
... ... @@ -12,7 +11,6 @@
12 11 <% environment.oauth_providers.each do |provider| %>
13 12 <tr>
14 13 <td><%= provider.name %></td>
15   - <td><%= provider.identifier %></td>
16 14 <td><%= provider.strategy %></td>
17 15 <td>
18 16 <%= link_to _('Edit'), {:action => 'edit', :id => provider.id} %>
... ...