X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/c9fe930b422bd1675af3adb324ede3b5aa28888c..d6598fd6339e6219a7103781433356dfde546527:/services/api/app/controllers/arvados/v1/users_controller.rb?ds=sidebyside diff --git a/services/api/app/controllers/arvados/v1/users_controller.rb b/services/api/app/controllers/arvados/v1/users_controller.rb index d9ab5556ff..cd23706d08 100644 --- a/services/api/app/controllers/arvados/v1/users_controller.rb +++ b/services/api/app/controllers/arvados/v1/users_controller.rb @@ -22,7 +22,15 @@ class Arvados::V1::UsersController < ApplicationController rescue ActiveRecord::RecordNotUnique retry end - u.update_attributes!(nullify_attrs(attrs)) + needupdate = {} + nullify_attrs(attrs).each do |k,v| + if !v.nil? && u.send(k) != v + needupdate[k] = v + end + end + if needupdate.length > 0 + u.update_attributes!(needupdate) + end @objects << u end @offset = 0 @@ -54,7 +62,11 @@ class Arvados::V1::UsersController < ApplicationController @object = current_user end if not @object.is_active - if not (current_user.is_admin or @object.is_invited) + if @object.uuid[0..4] == Rails.configuration.Login.LoginCluster && + @object.uuid[0..4] != Rails.configuration.ClusterID + logger.warn "Local user #{@object.uuid} called users#activate but only LoginCluster can do that" + raise ArgumentError.new "cannot activate user #{@object.uuid} here, only the #{@object.uuid[0..4]} cluster can do that" + elsif not (current_user.is_admin or @object.is_invited) logger.warn "User #{@object.uuid} called users.activate " + "but is not invited" raise ArgumentError.new "Cannot activate without being invited."