[arvados] created: 2.7.0-5090-g9c9c2ba3eb
git repository hosting
git at public.arvados.org
Thu Oct 26 17:37:29 UTC 2023
at 9c9c2ba3eb1b7c3a411348f373abcdc308aec0bb (commit)
commit 9c9c2ba3eb1b7c3a411348f373abcdc308aec0bb
Author: Peter Amstutz <peter.amstutz at curii.com>
Date: Thu Oct 26 13:37:00 2023 -0400
20284: username updates from login cluster always take precidence
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>
diff --git a/services/api/app/controllers/arvados/v1/users_controller.rb b/services/api/app/controllers/arvados/v1/users_controller.rb
index b872c0bbab..59de9d488e 100644
--- a/services/api/app/controllers/arvados/v1/users_controller.rb
+++ b/services/api/app/controllers/arvados/v1/users_controller.rb
@@ -37,8 +37,8 @@ class Arvados::V1::UsersController < ApplicationController
local_user = User.find_by_username(needupdate[:username])
# A cached user record from the LoginCluster is stale, reset its username
# and retry the update operation.
- if local_user.andand.uuid[0..4] == loginCluster && local_user.uuid != u.uuid
- new_username = "#{needupdate[:username]}conflict#{rand(99999999)}"
+ if local_user.uuid != u.uuid
+ new_username = "#{needupdate[:username]}#{rand(99999999)}"
Rails.logger.warn("cached username '#{needupdate[:username]}' collision with user '#{local_user.uuid}' - renaming to '#{new_username}' before retrying")
local_user.update!({username: new_username})
retry
diff --git a/services/api/test/functional/arvados/v1/users_controller_test.rb b/services/api/test/functional/arvados/v1/users_controller_test.rb
index 8bffac8dd1..fd1674a05a 100644
--- a/services/api/test/functional/arvados/v1/users_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/users_controller_test.rb
@@ -1043,12 +1043,16 @@ The Arvados team.
existinguuid = 'remot-tpzed-foobarbazwazqux'
newuuid = 'remot-tpzed-newnarnazwazqux'
unchanginguuid = 'remot-tpzed-nochangingattrs'
+ conflictinguuid1 = 'remot-tpzed-conflictingname'
+ conflictinguuid2 = 'remot-tpzed-conflictingname'
act_as_system_user do
User.create!(uuid: existinguuid, email: 'root at existing.example.com')
User.create!(uuid: unchanginguuid, email: 'root at unchanging.example.com', prefs: {'foo' => {'bar' => 'baz'}})
end
assert_equal(1, Log.where(object_uuid: unchanginguuid).count)
+ Rails.configuration.Login.LoginCluster = 'remot'
+
authorize_with(:admin)
patch(:batch_update,
params: {
@@ -1069,6 +1073,14 @@ The Arvados team.
'email' => 'root at unchanging.example.com',
'prefs' => {'foo' => {'bar' => 'baz'}},
},
+ conflictinguuid1 => {
+ 'email' => 'root at conflictingname1.example.com',
+ 'username' => 'active'
+ },
+ conflictinguuid1 => {
+ 'email' => 'root at conflictingname2.example.com',
+ 'username' => 'federatedactive'
+ },
}})
assert_response(:success)
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list