[ARVADOS] updated: 1.1.1-187-g934b2b2

Git user git at public.curoverse.com
Thu Dec 7 17:00:56 EST 2017


Summary of changes:
 services/api/app/models/api_client_authorization.rb | 9 ++++++---
 services/api/test/integration/remote_user_test.rb   | 2 ++
 2 files changed, 8 insertions(+), 3 deletions(-)

       via  934b2b25199cb4696fe6ad38406b3ec1cec8f9e8 (commit)
      from  afd47ec89aae6fa96dfedc53420b998b50d48318 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 934b2b25199cb4696fe6ad38406b3ec1cec8f9e8
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Thu Dec 7 16:59:59 2017 -0500

    11453: Restore update of email/prefs/name on subsequent remote auth.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>

diff --git a/services/api/app/models/api_client_authorization.rb b/services/api/app/models/api_client_authorization.rb
index 9a82d05..3af206c 100644
--- a/services/api/app/models/api_client_authorization.rb
+++ b/services/api/app/models/api_client_authorization.rb
@@ -153,10 +153,9 @@ class ApiClientAuthorization < ArvadosModel
         # validate subsequent requests faster.
 
         user = User.find_or_create_by(uuid: remote_user['uuid']) do |user|
+          # (this block runs for the "create" case, not for "find")
           user.is_admin = false
-          %w[first_name last_name email prefs].each do |attr|
-            user.send(attr+'=', remote_user[attr])
-          end
+          user.email = remote_user['email']
           if remote_user['username'].andand.length.andand > 0
             user.set_initial_username(requested: remote_user['username'])
           end
@@ -170,6 +169,10 @@ class ApiClientAuthorization < ArvadosModel
           user.is_active = false
         end
 
+        %w[first_name last_name email prefs].each do |attr|
+          user.send(attr+'=', remote_user[attr])
+        end
+
         user.save!
 
         auth = ApiClientAuthorization.find_or_create_by(uuid: uuid) do |auth|
diff --git a/services/api/test/integration/remote_user_test.rb b/services/api/test/integration/remote_user_test.rb
index f820bad4..591bbaf 100644
--- a/services/api/test/integration/remote_user_test.rb
+++ b/services/api/test/integration/remote_user_test.rb
@@ -107,9 +107,11 @@ class RemoteUsersTest < ActionDispatch::IntegrationTest
     # revive original token and re-authorize
     @stub_status = 200
     @stub_content[:username] = 'blarney'
+    @stub_content[:email] = 'blarney at example.com'
     get '/arvados/v1/users/current', {format: 'json'}, auth(remote: 'zbbbb')
     assert_response :success
     assert_equal 'barney', json_response['username'], 'local username should not change once assigned'
+    assert_equal 'blarney at example.com', json_response['email']
   end
 
   test 'authenticate with remote token, remote username conflicts with local' do

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list