Commit 52baa4618e5ec6413b1982a5512b9ee2ce3ca24c

Authored by Larissa Reis
1 parent 3b26008f

Adapt external person attributes and current_user to allow for external login

app/concerns/authenticated_system.rb
@@ -27,7 +27,7 @@ module AuthenticatedSystem @@ -27,7 +27,7 @@ module AuthenticatedSystem
27 @current_user ||= begin 27 @current_user ||= begin
28 user = nil 28 user = nil
29 if session[:external] 29 if session[:external]
30 - user = User.new 30 + user = User.new #FIXME: User needs to have at least email
31 user.external_person_id = session[:external] 31 user.external_person_id = session[:external]
32 else 32 else
33 id = session[:user] 33 id = session[:user]
app/controllers/my_profile/email_templates_controller.rb
@@ -64,7 +64,7 @@ class EmailTemplatesController < ApplicationController @@ -64,7 +64,7 @@ class EmailTemplatesController < ApplicationController
64 private 64 private
65 65
66 def template_params 66 def template_params
67 - {:profile_name => current_user.name, :environment_name => environment.name } 67 + {:profile_name => current_person.name, :environment_name => environment.name }
68 end 68 end
69 69
70 def template_params_allowed params 70 def template_params_allowed params
app/controllers/public/profile_controller.rb
@@ -176,7 +176,7 @@ class ProfileController < PublicController @@ -176,7 +176,7 @@ class ProfileController < PublicController
176 end 176 end
177 177
178 def unblock 178 def unblock
179 - if current_user.person.is_admin?(profile.environment) 179 + if current_person.is_admin?(profile.environment)
180 profile.unblock 180 profile.unblock
181 session[:notice] = _("You have unblocked %s successfully. ") % profile.name 181 session[:notice] = _("You have unblocked %s successfully. ") % profile.name
182 redirect_to :controller => 'profile', :action => 'index' 182 redirect_to :controller => 'profile', :action => 'index'
@@ -187,7 +187,7 @@ class ProfileController < PublicController @@ -187,7 +187,7 @@ class ProfileController < PublicController
187 end 187 end
188 188
189 def leave_scrap 189 def leave_scrap
190 - sender = params[:sender_id].nil? ? current_user.person : Person.find(params[:sender_id]) 190 + sender = params[:sender_id].nil? ? current_person : Person.find(params[:sender_id])
191 receiver = params[:receiver_id].nil? ? @profile : Person.find(params[:receiver_id]) 191 receiver = params[:receiver_id].nil? ? @profile : Person.find(params[:receiver_id])
192 @scrap = Scrap.new(params[:scrap]) 192 @scrap = Scrap.new(params[:scrap])
193 @scrap.sender= sender 193 @scrap.sender= sender
@@ -270,7 +270,7 @@ class ProfileController < PublicController @@ -270,7 +270,7 @@ class ProfileController < PublicController
270 270
271 def remove_scrap 271 def remove_scrap
272 begin 272 begin
273 - scrap = current_user.person.scraps(params[:scrap_id]) 273 + scrap = current_person.scraps(params[:scrap_id])
274 scrap.destroy 274 scrap.destroy
275 finish_successful_removal 'Scrap successfully removed.' 275 finish_successful_removal 'Scrap successfully removed.'
276 rescue 276 rescue
app/controllers/public/search_controller.rb
@@ -247,7 +247,7 @@ class SearchController < PublicController @@ -247,7 +247,7 @@ class SearchController < PublicController
247 def visible_profiles(klass, *extra_relations) 247 def visible_profiles(klass, *extra_relations)
248 relations = [:image, :domains, :environment, :preferred_domain] 248 relations = [:image, :domains, :environment, :preferred_domain]
249 relations += extra_relations 249 relations += extra_relations
250 - if current_user && current_user.person.is_admin? 250 + if current_user && current_person.is_admin?
251 @environment.send(klass.name.underscore.pluralize).includes(relations) 251 @environment.send(klass.name.underscore.pluralize).includes(relations)
252 else 252 else
253 @environment.send(klass.name.underscore.pluralize).visible.includes(relations) 253 @environment.send(klass.name.underscore.pluralize).visible.includes(relations)
app/helpers/application_helper.rb
@@ -146,12 +146,12 @@ module ApplicationHelper @@ -146,12 +146,12 @@ module ApplicationHelper
146 end 146 end
147 147
148 def link_to_cms(text, profile = nil, options = {}) 148 def link_to_cms(text, profile = nil, options = {})
149 - profile ||= current_user.login 149 + profile ||= current_person.identifier
150 link_to text, myprofile_path(:controller => 'cms', :profile => profile), options 150 link_to text, myprofile_path(:controller => 'cms', :profile => profile), options
151 end 151 end
152 152
153 def link_to_profile(text, profile = nil, options = {}) 153 def link_to_profile(text, profile = nil, options = {})
154 - profile ||= current_user.login 154 + profile ||= current_person.identifier
155 link_to text, profile_path(:profile => profile) , options 155 link_to text, profile_path(:profile => profile) , options
156 end 156 end
157 157
@@ -160,7 +160,7 @@ module ApplicationHelper @@ -160,7 +160,7 @@ module ApplicationHelper
160 end 160 end
161 161
162 def link_if_permitted(link, permission = nil, target = nil) 162 def link_if_permitted(link, permission = nil, target = nil)
163 - if permission.nil? || current_user.person.has_permission?(permission, target) 163 + if permission.nil? || current_person.has_permission?(permission, target)
164 link 164 link
165 else 165 else
166 nil 166 nil
@@ -813,8 +813,8 @@ module ApplicationHelper @@ -813,8 +813,8 @@ module ApplicationHelper
813 {s_('contents|More viewed') => {href: url_for({host: host, controller: 'search', action: 'contents', filter: 'more_popular'})}}, 813 {s_('contents|More viewed') => {href: url_for({host: host, controller: 'search', action: 'contents', filter: 'more_popular'})}},
814 {s_('contents|Most commented') => {href: url_for({host: host, controller: 'search', action: 'contents', filter: 'more_comments'})}} 814 {s_('contents|Most commented') => {href: url_for({host: host, controller: 'search', action: 'contents', filter: 'more_comments'})}}
815 ] 815 ]
816 - if logged_in? && !current_user.external_person_id  
817 - links.push(_('New content') => modal_options({:href => url_for({:controller => 'cms', :action => 'new', :profile => current_user.login, :cms => true})})) 816 + if logged_in?
  817 + links.push(_('New content') => modal_options({:href => url_for({:controller => 'cms', :action => 'new', :profile => current_person.identifier, :cms => true})}))
818 end 818 end
819 819
820 link_to(content_tag(:span, _('Contents'), :class => 'icon-menu-articles'), {:controller => "search", :action => 'contents', :category_path => nil}, :id => 'submenu-contents') + 820 link_to(content_tag(:span, _('Contents'), :class => 'icon-menu-articles'), {:controller => "search", :action => 'contents', :category_path => nil}, :id => 'submenu-contents') +
@@ -829,9 +829,9 @@ module ApplicationHelper @@ -829,9 +829,9 @@ module ApplicationHelper
829 {s_('people|More active') => {href: url_for({host: host, controller: 'search', action: 'people', filter: 'more_active'})}}, 829 {s_('people|More active') => {href: url_for({host: host, controller: 'search', action: 'people', filter: 'more_active'})}},
830 {s_('people|More popular') => {href: url_for({host: host, controller: 'search', action: 'people', filter: 'more_popular'})}} 830 {s_('people|More popular') => {href: url_for({host: host, controller: 'search', action: 'people', filter: 'more_popular'})}}
831 ] 831 ]
832 - if logged_in? && !current_user.external_person_id  
833 - links.push(_('My friends') => {:href => url_for({:profile => current_user.login, :controller => 'friends'})})  
834 - links.push(_('Invite friends') => {:href => url_for({:profile => current_user.login, :controller => 'invite', :action => 'friends'})}) 832 + if logged_in?
  833 + links.push(_('My friends') => {:href => url_for({:profile => current_person.identifier, :controller => 'friends'})})
  834 + links.push(_('Invite friends') => {:href => url_for({:profile => current_person.identifier, :controller => 'invite', :action => 'friends'})})
835 end 835 end
836 836
837 link_to(content_tag(:span, _('People'), :class => 'icon-menu-people'), {:controller => "search", :action => 'people', :category_path => ''}, :id => 'submenu-people') + 837 link_to(content_tag(:span, _('People'), :class => 'icon-menu-people'), {:controller => "search", :action => 'people', :category_path => ''}, :id => 'submenu-people') +
@@ -846,9 +846,9 @@ module ApplicationHelper @@ -846,9 +846,9 @@ module ApplicationHelper
846 {s_('communities|More active') => {href: url_for({host: host, controller: 'search', action: 'communities', filter: 'more_active'})}}, 846 {s_('communities|More active') => {href: url_for({host: host, controller: 'search', action: 'communities', filter: 'more_active'})}},
847 {s_('communities|More popular') => {href: url_for({host: host, controller: 'search', action: 'communities', filter: 'more_popular'})}} 847 {s_('communities|More popular') => {href: url_for({host: host, controller: 'search', action: 'communities', filter: 'more_popular'})}}
848 ] 848 ]
849 - if logged_in? && !current_user.external_person_id  
850 - links.push(_('My communities') => {:href => url_for({:profile => current_user.login, :controller => 'memberships'})})  
851 - links.push(_('New community') => {:href => url_for({:profile => current_user.login, :controller => 'memberships', :action => 'new_community'})}) 849 + if logged_in?
  850 + links.push(_('My communities') => {:href => url_for({:profile => current_person.identifier, :controller => 'memberships'})})
  851 + links.push(_('New community') => {:href => url_for({:profile => current_person.identifier, :controller => 'memberships', :action => 'new_community'})})
852 end 852 end
853 853
854 link_to(content_tag(:span, _('Communities'), :class => 'icon-menu-community'), {:controller => "search", :action => 'communities'}, :id => 'submenu-communities') + 854 link_to(content_tag(:span, _('Communities'), :class => 'icon-menu-community'), {:controller => "search", :action => 'communities'}, :id => 'submenu-communities') +
app/models/concerns/external_user.rb
@@ -49,8 +49,9 @@ module ExternalUser @@ -49,8 +49,9 @@ module ExternalUser
49 webfinger = OpenStruct.new( 49 webfinger = OpenStruct.new(
50 identifier: user['user']['person']['identifier'], 50 identifier: user['user']['person']['identifier'],
51 name: user['user']['person']['name'], 51 name: user['user']['person']['name'],
  52 + created_at: user['user']['person']['created_at'],
52 domain: domain, 53 domain: domain,
53 - email_md5: Digest::MD5.hexdigest(user['user']['email']) 54 + email: user['user']['email']
54 ) 55 )
55 u.external_person_id = ExternalPerson.get_or_create(webfinger).id 56 u.external_person_id = ExternalPerson.get_or_create(webfinger).id
56 return u 57 return u
app/models/concerns/profile_entity.rb
@@ -35,4 +35,34 @@ module ProfileEntity @@ -35,4 +35,34 @@ module ProfileEntity
35 true 35 true
36 end 36 end
37 37
  38 + # returns +false+
  39 + def person?
  40 + self.kind_of?(Person)
  41 + end
  42 +
  43 + def enterprise?
  44 + self.kind_of?(Enterprise)
  45 + end
  46 +
  47 + def organization?
  48 + self.kind_of?(Organization)
  49 + end
  50 +
  51 + def community?
  52 + self.kind_of?(Community)
  53 + end
  54 +
  55 + include ActionView::Helpers::TextHelper
  56 + def short_name(chars = 40)
  57 + if self[:nickname].blank?
  58 + if chars
  59 + truncate self.name, length: chars, omission: '...'
  60 + else
  61 + self.name
  62 + end
  63 + else
  64 + self[:nickname]
  65 + end
  66 + end
  67 +
38 end 68 end
app/models/environment.rb
@@ -1010,8 +1010,7 @@ class Environment < ApplicationRecord @@ -1010,8 +1010,7 @@ class Environment < ApplicationRecord
1010 end 1010 end
1011 1011
1012 def has_federated_network?(domain) 1012 def has_federated_network?(domain)
1013 - # FIXME: Should return whether "domain" is whitelisted in this environment as a federated network  
1014 - true 1013 + self.federated_networks.map(&:url).any? {|url| /http[s]?:\/\/#{domain}\/?/ =~ url }
1015 end 1014 end
1016 1015
1017 private 1016 private
app/models/external_person.rb
@@ -6,7 +6,7 @@ class ExternalPerson < ActiveRecord::Base @@ -6,7 +6,7 @@ class ExternalPerson < ActiveRecord::Base
6 6
7 validates_uniqueness_of :identifier, scope: :source 7 validates_uniqueness_of :identifier, scope: :source
8 8
9 - attr_accessible :source, :email_md5_hash 9 + attr_accessible :source, :email, :created_at
10 10
11 def self.get_or_create(webfinger) 11 def self.get_or_create(webfinger)
12 user = ExternalPerson.find_by(identifier: webfinger.identifier, source: webfinger.domain) 12 user = ExternalPerson.find_by(identifier: webfinger.identifier, source: webfinger.domain)
@@ -14,7 +14,8 @@ class ExternalPerson < ActiveRecord::Base @@ -14,7 +14,8 @@ class ExternalPerson < ActiveRecord::Base
14 user = ExternalPerson.create!(identifier: webfinger.identifier, 14 user = ExternalPerson.create!(identifier: webfinger.identifier,
15 name: webfinger.name, 15 name: webfinger.name,
16 source: webfinger.domain, 16 source: webfinger.domain,
17 - email_md5_hash: webfinger.email_md5 17 + email: webfinger.email,
  18 + created_at: webfinger.created_at
18 ) 19 )
19 end 20 end
20 user 21 user
@@ -24,12 +25,83 @@ class ExternalPerson < ActiveRecord::Base @@ -24,12 +25,83 @@ class ExternalPerson < ActiveRecord::Base
24 "http://#{self.source}/#{self.identifier}" 25 "http://#{self.source}/#{self.identifier}"
25 end 26 end
26 27
  28 + alias :public_profile_url :url
  29 +
27 def avatar 30 def avatar
28 - "http://#{self.source}/plugin/gravatar_provider/h/#{self.email_md5_hash}" 31 + "http://#{self.source}/plugin/gravatar_provider/h/#{Digest::MD5.hexdigest(self.email)}"
  32 + end
  33 +
  34 + def admin_url
  35 + "http://#{self.source}/myprofile/#{self.identifier}"
  36 + end
  37 +
  38 + def profile_custom_icon(gravatar_default=nil)
  39 + self.avatar
29 end 40 end
30 41
31 def preferred_login_redirection 42 def preferred_login_redirection
32 environment.redirection_after_login 43 environment.redirection_after_login
33 end 44 end
34 45
  46 + def person?
  47 + true
  48 + end
  49 +
  50 + def is_admin?(environment = nil)
  51 + false
  52 + end
  53 +
  54 + def lat
  55 + nil
  56 + end
  57 + def lng
  58 + nil
  59 + end
  60 +
  61 + def role_assignments
  62 + RoleAssignment.none
  63 + end
  64 +
  65 + def favorite_enterprises
  66 + Enterprise.none
  67 + end
  68 +
  69 + def memberships
  70 + Profile.none
  71 + end
  72 +
  73 + def friendships
  74 + Profile.none
  75 + end
  76 +
  77 + def follows?(profile)
  78 + false
  79 + end
  80 +
  81 + def is_a_friend?(person)
  82 + false
  83 + end
  84 +
  85 + def already_request_friendship?(person)
  86 + false
  87 + end
  88 +
  89 + class ExternalPerson::Image
  90 + attr_accessor :path
  91 + def initialize(path)
  92 + self.path = path
  93 + end
  94 + def public_filename(size = nil)
  95 + self.path
  96 + end
  97 +
  98 + def content_type
  99 + 'image/png'
  100 + end
  101 + end
  102 +
  103 + def image
  104 + ExternalPerson::Image.new(avatar)
  105 + end
  106 +
35 end 107 end
app/models/profile.rb
@@ -549,23 +549,6 @@ class Profile < ApplicationRecord @@ -549,23 +549,6 @@ class Profile < ApplicationRecord
549 environment 549 environment
550 end 550 end
551 551
552 - # returns +false+  
553 - def person?  
554 - self.kind_of?(Person)  
555 - end  
556 -  
557 - def enterprise?  
558 - self.kind_of?(Enterprise)  
559 - end  
560 -  
561 - def organization?  
562 - self.kind_of?(Organization)  
563 - end  
564 -  
565 - def community?  
566 - self.kind_of?(Community)  
567 - end  
568 -  
569 # returns false. 552 # returns false.
570 def is_validation_entity? 553 def is_validation_entity?
571 false 554 false
@@ -803,19 +786,6 @@ private :generate_url, :url_options @@ -803,19 +786,6 @@ private :generate_url, :url_options
803 !forbidden.include?(cat.class) 786 !forbidden.include?(cat.class)
804 end 787 end
805 788
806 - include ActionView::Helpers::TextHelper  
807 - def short_name(chars = 40)  
808 - if self[:nickname].blank?  
809 - if chars  
810 - truncate self.name, length: chars, omission: '...'  
811 - else  
812 - self.name  
813 - end  
814 - else  
815 - self[:nickname]  
816 - end  
817 - end  
818 -  
819 def custom_header 789 def custom_header
820 self[:custom_header] || environment && environment.custom_header 790 self[:custom_header] || environment && environment.custom_header
821 end 791 end
app/models/user.rb
@@ -149,7 +149,7 @@ class User < ApplicationRecord @@ -149,7 +149,7 @@ class User < ApplicationRecord
149 u.generate_private_token_if_not_exist 149 u.generate_private_token_if_not_exist
150 return u 150 return u
151 end 151 end
152 - 152 +
153 return User.external_authenticate(login, password, environment) 153 return User.external_authenticate(login, password, environment)
154 end 154 end
155 155
app/views/account/welcome.html.erb
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 <%= _('%s was successfuly activated. Now you may go to your control panel or to the control panel of your enterprise') % @enterprise.name %> 4 <%= _('%s was successfuly activated. Now you may go to your control panel or to the control panel of your enterprise') % @enterprise.name %>
5 5
6 <%= button_bar do %> 6 <%= button_bar do %>
7 - <%= button 'forward', _('Go to my control panel'), :action => 'index', :controller => 'profile_editor', :profile => current_user.person.identifier %> 7 + <%= button 'forward', _('Go to my control panel'), :action => 'index', :controller => 'profile_editor', :profile => current_person.identifier %>
8 <%= button 'forward', _('Go to my enterprise control panel') % @enterprise.name, :action => 'index', :controller => 'profile_editor', :profile => @enterprise.identifier %> 8 <%= button 'forward', _('Go to my enterprise control panel') % @enterprise.name, :action => 'index', :controller => 'profile_editor', :profile => @enterprise.identifier %>
9 <% end %> 9 <% end %>
10 <% end %> 10 <% end %>
app/views/enterprise_registration/basic_information.html.erb
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 </div> 9 </div>
10 10
11 <%= button_bar do %> 11 <%= button_bar do %>
12 - <%= button :back, _('Go back'), { :profile => current_user.person.identifier, :action=>"enterprises", :controller=>"profile" }%> 12 + <%= button :back, _('Go back'), { :profile => current_person.identifier, :action=>"enterprises", :controller=>"profile" }%>
13 <% end %> 13 <% end %>
14 <% else %> 14 <% else %>
15 <div class='atention'> 15 <div class='atention'>
@@ -37,7 +37,7 @@ @@ -37,7 +37,7 @@
37 <%= template_options(:enterprises, 'create_enterprise')%> 37 <%= template_options(:enterprises, 'create_enterprise')%>
38 38
39 <%= button_bar do %> 39 <%= button_bar do %>
40 - <%= submit_button('next', _('Next'), :cancel => {:profile => current_user.person.identifier, :action=>"enterprises", :controller=>"profile"}) %> 40 + <%= submit_button('next', _('Next'), :cancel => {:profile => current_person.identifier, :action=>"enterprises", :controller=>"profile"}) %>
41 <% end %> 41 <% end %>
42 <% end %> 42 <% end %>
43 <% end %> 43 <% end %>
app/views/environment_role_manager/affiliate.html.erb
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 2
3 <%= form_tag( {:action => 'give_role'}, {:method => :post}) do %> 3 <%= form_tag( {:action => 'give_role'}, {:method => :post}) do %>
4 <%= select_tag 'role', options_for_select(@roles.map{|r|[r.name,r.id]}) %> 4 <%= select_tag 'role', options_for_select(@roles.map{|r|[r.name,r.id]}) %>
5 - <%= hidden_field_tag 'person', current_user.person.id %> 5 + <%= hidden_field_tag 'person', current_person.id %>
6 <%= button_bar do %> 6 <%= button_bar do %>
7 <%= submit_button('affiliate', _('Affiliate', :cancel => {:action => 'index'}) %> 7 <%= submit_button('affiliate', _('Affiliate', :cancel => {:action => 'index'}) %>
8 <% end %> 8 <% end %>
app/views/layouts/_user.html.erb
1 <div id="user"> 1 <div id="user">
2 <% user = (session[:user] && User.find_by(id: session[:user])) || nil %> 2 <% user = (session[:user] && User.find_by(id: session[:user])) || nil %>
  3 + <% user ||= (session[:external] && User.new(:external_person_id => session[:external])) || nil %>
3 <% if user.present? %> 4 <% if user.present? %>
4 <% user = user.person %> 5 <% user = user.person %>
5 <span class='logged-in'> 6 <span class='logged-in'>
app/views/profile_members/affiliate.html.erb
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 2
3 <%= form_tag( {:action => 'give_role'}, {:method => :post}) do %> 3 <%= form_tag( {:action => 'give_role'}, {:method => :post}) do %>
4 <%= select_tag 'role', options_for_select(@roles.map{|r|[r.name,r.id]}) %> 4 <%= select_tag 'role', options_for_select(@roles.map{|r|[r.name,r.id]}) %>
5 - <%= hidden_field_tag 'person', current_user.person.id %> 5 + <%= hidden_field_tag 'person', current_person.id %>
6 <%= button_bar do %> 6 <%= button_bar do %>
7 <%= submit_button('affiliate', _('Affiliate'), :cancel => {:action => 'index'}) %> 7 <%= submit_button('affiliate', _('Affiliate'), :cancel => {:action => 'index'}) %>
8 <% end %> 8 <% end %>
db/migrate/20160420140141_create_external_person.rb
@@ -4,9 +4,11 @@ class CreateExternalPerson &lt; ActiveRecord::Migration @@ -4,9 +4,11 @@ class CreateExternalPerson &lt; ActiveRecord::Migration
4 t.string :name 4 t.string :name
5 t.string :identifier 5 t.string :identifier
6 t.string :source 6 t.string :source
7 - t.string :email_md5_hash 7 + t.string :email
8 t.integer :environment_id 8 t.integer :environment_id
9 t.boolean :visible, default: true 9 t.boolean :visible, default: true
  10 + t.datetime :created_at
  11 + t.datetime :updated_at
10 end 12 end
11 end 13 end
12 end 14 end
plugins/organization_ratings/controllers/organization_ratings_plugin_profile_controller.rb
@@ -38,7 +38,7 @@ class OrganizationRatingsPluginProfileController &lt; ProfileController @@ -38,7 +38,7 @@ class OrganizationRatingsPluginProfileController &lt; ProfileController
38 38
39 def create_new_rate 39 def create_new_rate
40 @rating = OrganizationRating.new(params[:organization_rating]) 40 @rating = OrganizationRating.new(params[:organization_rating])
41 - @rating.person = current_user.person 41 + @rating.person = current_person
42 @rating.organization = profile 42 @rating.organization = profile
43 @rating.value = params[:organization_rating_value] if params[:organization_rating_value] 43 @rating.value = params[:organization_rating_value] if params[:organization_rating_value]
44 44
plugins/organization_ratings/views/organization_ratings_plugin_profile/_new_rating_fields.html.erb
@@ -9,11 +9,11 @@ @@ -9,11 +9,11 @@
9 9
10 <div class="star-profile-information"> 10 <div class="star-profile-information">
11 <div class="star-profile-image"> 11 <div class="star-profile-image">
12 - <%= link_to profile_image(current_user.person, :portrait), current_user.person.url %> 12 + <%= link_to profile_image(current_person, :portrait), current_person.url %>
13 </div> 13 </div>
14 14
15 <div class="star-profile-name"> 15 <div class="star-profile-name">
16 - <%= link_to current_user.person.name, current_user.person.url %> 16 + <%= link_to current_person.name, current_person.url %>
17 </div> 17 </div>
18 </div> 18 </div>
19 19
@@ -59,14 +59,14 @@ @@ -59,14 +59,14 @@
59 </div> 59 </div>
60 <% elsif env_organization_ratings_config.vote_once %> 60 <% elsif env_organization_ratings_config.vote_once %>
61 <div class="star-rate-form rating-vote-once"> 61 <div class="star-rate-form rating-vote-once">
62 - <%= _("Hi, %s! The administrators set that you can vote") % current_user.name %> 62 + <%= _("Hi, %s! The administrators set that you can vote") % current_person.name %>
63 <strong><%= _("only once") %></strong> 63 <strong><%= _("only once") %></strong>
64 <%= _("for this %s.") % profile.class.name.downcase %> 64 <%= _("for this %s.") % profile.class.name.downcase %>
65 <%= render :partial => 'shared/rating_button', :locals => { :disabled => true } %> 65 <%= render :partial => 'shared/rating_button', :locals => { :disabled => true } %>
66 </div> 66 </div>
67 <% else %> 67 <% else %>
68 <div class="star-rate-form rating-cooldown"> 68 <div class="star-rate-form rating-cooldown">
69 - <%= _("Hi, %s! The administrators set the minimum time of") % current_user.name %> 69 + <%= _("Hi, %s! The administrators set the minimum time of") % current_person.name %>
70 <strong><%= _("%d hour(s)") % env_organization_ratings_config.cooldown %></strong> 70 <strong><%= _("%d hour(s)") % env_organization_ratings_config.cooldown %></strong>
71 <%= _("between each evaluation.") %> 71 <%= _("between each evaluation.") %>
72 72
plugins/organization_ratings/views/shared/_make_report_block.html.erb
1 -<% logged_in_image = link_to profile_image(current_user.person, :portrait), current_user.person.url if current_user %>  
2 -<% logged_in_name = link_to current_user.person.name, current_user.person.url if current_user %> 1 +<% logged_in_image = link_to profile_image(current_person, :portrait), current_person.url if current_user %>
  2 +<% logged_in_name = link_to current_person.name, current_person.url if current_user %>
3 <% logged_out_image = image_tag('plugins/organization_ratings/public/images/user-not-logged.png') %> 3 <% logged_out_image = image_tag('plugins/organization_ratings/public/images/user-not-logged.png') %>
4 4
5 <div class="make-report-block"> 5 <div class="make-report-block">
@@ -26,4 +26,4 @@ @@ -26,4 +26,4 @@
26 </div> 26 </div>
27 <% end %> 27 <% end %>
28 </div> 28 </div>
29 -</div>  
30 \ No newline at end of file 29 \ No newline at end of file
  30 +</div>
plugins/responsive/lib/ext/application_helper.rb
@@ -140,7 +140,7 @@ module ApplicationHelper @@ -140,7 +140,7 @@ module ApplicationHelper
140 [s_('contents|Most commented'), {host: host, controller: :search, action: :contents, filter: 'more_comments'}], 140 [s_('contents|Most commented'), {host: host, controller: :search, action: :contents, filter: 'more_comments'}],
141 ] 141 ]
142 if logged_in? 142 if logged_in?
143 - links.push [_('New content'), '', modal_options({href: url_for({controller: 'cms', action: 'new', profile: current_user.login, cms: true})})] 143 + links.push [_('New content'), '', modal_options({href: url_for({controller: 'cms', action: 'new', profile: current_person.identifier, cms: true})})]
144 end 144 end
145 145
146 content_tag :li, class: 'dropdown' do 146 content_tag :li, class: 'dropdown' do
@@ -170,8 +170,8 @@ module ApplicationHelper @@ -170,8 +170,8 @@ module ApplicationHelper
170 [s_('people|More popular'), {host: host, controller: :search, action: :people, filter: 'more_popular'}], 170 [s_('people|More popular'), {host: host, controller: :search, action: :people, filter: 'more_popular'}],
171 ] 171 ]
172 if logged_in? 172 if logged_in?
173 - links.push [_('My friends'), {profile: current_user.login, controller: 'friends'}]  
174 - links.push [_('Invite friends'), {profile: current_user.login, controller: 'invite', action: 'friends'}] 173 + links.push [_('My friends'), {profile: current_person.identifier, controller: 'friends'}]
  174 + links.push [_('Invite friends'), {profile: current_person.identifier, controller: 'invite', action: 'friends'}]
175 end 175 end
176 176
177 content_tag :li, class: 'dropdown' do 177 content_tag :li, class: 'dropdown' do
@@ -201,8 +201,8 @@ module ApplicationHelper @@ -201,8 +201,8 @@ module ApplicationHelper
201 [s_('communities|More popular'), {host: host, controller: :search, action: :communities, filter: 'more_popular'}], 201 [s_('communities|More popular'), {host: host, controller: :search, action: :communities, filter: 'more_popular'}],
202 ] 202 ]
203 if logged_in? 203 if logged_in?
204 - links.push [_('My communities'), {profile: current_user.login, controller: 'memberships'}]  
205 - links.push [_('New community'), {profile: current_user.login, controller: 'memberships', action: 'new_community'}] 204 + links.push [_('My communities'), {profile: current_person.identifier, controller: 'memberships'}]
  205 + links.push [_('New community'), {profile: current_person.identifier, controller: 'memberships', action: 'new_community'}]
206 end 206 end
207 207
208 content_tag :li, class: 'dropdown' do 208 content_tag :li, class: 'dropdown' do
plugins/sniffer/views/blocks/interests.html.erb
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 </ul> 8 </ul>
9 9
10 <div> 10 <div>
11 - <% if logged_in? and (current_user.person.is_admin?(environment) or profile.admins.include?(current_user.person)) %> 11 + <% if logged_in? and (current_person.is_admin?(environment) or profile.admins.include?(current_person)) %>
12 <%= _('Edit %{inputs} and %{block.interests}') % { 12 <%= _('Edit %{inputs} and %{block.interests}') % {
13 :inputs => link_to(_("products' inputs"), :controller => :manage_products, :action => :index), 13 :inputs => link_to(_("products' inputs"), :controller => :manage_products, :action => :index),
14 :interests => link_to(_('declared interests'), :controller => :sniffer_plugin_myprofile, :action => :edit), 14 :interests => link_to(_('declared interests'), :controller => :sniffer_plugin_myprofile, :action => :edit),
plugins/solr/lib/solr_plugin/search_helper.rb
@@ -12,9 +12,9 @@ module SolrPlugin::SearchHelper @@ -12,9 +12,9 @@ module SolrPlugin::SearchHelper
12 :products => ActiveSupport::OrderedHash[ :none, {:label => _('Relevance')}, 12 :products => ActiveSupport::OrderedHash[ :none, {:label => _('Relevance')},
13 :more_recent, {:label => c_('More recent'), :solr_opts => {:sort => 'updated_at desc, score desc'}}, 13 :more_recent, {:label => c_('More recent'), :solr_opts => {:sort => 'updated_at desc, score desc'}},
14 :name, {:label => _('Name'), :solr_opts => {:sort => 'solr_plugin_name_sortable asc'}}, 14 :name, {:label => _('Name'), :solr_opts => {:sort => 'solr_plugin_name_sortable asc'}},
15 - :closest, {:label => _('Closest to me'), :if => proc{ logged_in? && (profile=current_user.person).lat && profile.lng }, 15 + :closest, {:label => _('Closest to me'), :if => proc{ logged_in? && (profile=current_person).lat && profile.lng },
16 :solr_opts => {:sort => "geodist() asc", 16 :solr_opts => {:sort => "geodist() asc",
17 - :latitude => proc{ current_user.person.lat }, :longitude => proc{ current_user.person.lng }}}, 17 + :latitude => proc{ current_person.lat }, :longitude => proc{ current_person.lng }}},
18 ], 18 ],
19 :events => ActiveSupport::OrderedHash[ :none, {:label => _('Relevance')}, 19 :events => ActiveSupport::OrderedHash[ :none, {:label => _('Relevance')},
20 :name, {:label => _('Name'), :solr_opts => {:sort => 'solr_plugin_name_sortable asc'}}, 20 :name, {:label => _('Name'), :solr_opts => {:sort => 'solr_plugin_name_sortable asc'}},