Commit cb383dadbd564205d76a8f4d50dcf71ca7764cf9
1 parent
7664b827
Exists in
master
and in
29 other branches
stoa_plugin: remove sensitive fields from person api
(ActionItem2832)
Showing
3 changed files
with
2 additions
and
6 deletions
Show diff stats
plugins/stoa/controllers/stoa_plugin_controller.rb
@@ -49,7 +49,6 @@ class StoaPluginController < PublicController | @@ -49,7 +49,6 @@ class StoaPluginController < PublicController | ||
49 | return fields.reject { |field| !FIELDS['essential'].include?(field) } unless user.person.public_profile | 49 | return fields.reject { |field| !FIELDS['essential'].include?(field) } unless user.person.public_profile |
50 | fields.reject do |field| | 50 | fields.reject do |field| |
51 | !user.person.public_fields.include?(field) && | 51 | !user.person.public_fields.include?(field) && |
52 | - SENSITIVE.include?(field) && | ||
53 | !FIELDS['essential'].include?(field) | 52 | !FIELDS['essential'].include?(field) |
54 | end | 53 | end |
55 | end | 54 | end |
plugins/stoa/lib/stoa_plugin/person_fields.rb
plugins/stoa/test/functional/stoa_plugin_controller_test.rb
@@ -102,13 +102,12 @@ class StoaPluginControllerTest < ActionController::TestCase | @@ -102,13 +102,12 @@ class StoaPluginControllerTest < ActionController::TestCase | ||
102 | assert response.blank? | 102 | assert response.blank? |
103 | end | 103 | end |
104 | 104 | ||
105 | - should 'not return sensitive fields that are private' do | 105 | + should 'not return private fields' do |
106 | @request.stubs(:ssl?).returns(true) | 106 | @request.stubs(:ssl?).returns(true) |
107 | Person.any_instance.stubs(:f1).returns('field1') | 107 | Person.any_instance.stubs(:f1).returns('field1') |
108 | Person.any_instance.stubs(:f2).returns('field2') | 108 | Person.any_instance.stubs(:f2).returns('field2') |
109 | Person.any_instance.stubs(:f3).returns('field3') | 109 | Person.any_instance.stubs(:f3).returns('field3') |
110 | StoaPluginController::FIELDS['special'] = %w[f1 f2 f3] | 110 | StoaPluginController::FIELDS['special'] = %w[f1 f2 f3] |
111 | - StoaPluginController::SENSITIVE = %w[f1 f2] | ||
112 | person = user.person | 111 | person = user.person |
113 | person.fields_privacy = {:f1 => 'private', :f2 => 'public', :f3 => 'public'} | 112 | person.fields_privacy = {:f1 => 'private', :f2 => 'public', :f3 => 'public'} |
114 | person.save! | 113 | person.save! |
@@ -120,9 +119,8 @@ class StoaPluginControllerTest < ActionController::TestCase | @@ -120,9 +119,8 @@ class StoaPluginControllerTest < ActionController::TestCase | ||
120 | assert json_response.keys.include?('f3') | 119 | assert json_response.keys.include?('f3') |
121 | end | 120 | end |
122 | 121 | ||
123 | - should 'return essential fields even if they are sensitive and private' do | 122 | + should 'return essential fields even if they are private' do |
124 | @request.stubs(:ssl?).returns(true) | 123 | @request.stubs(:ssl?).returns(true) |
125 | - StoaPluginController::SENSITIVE = %w[email] | ||
126 | person = user.person | 124 | person = user.person |
127 | person.fields_privacy = {:email => 'private'} | 125 | person.fields_privacy = {:email => 'private'} |
128 | person.save! | 126 | person.save! |