X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/e102a3b3100577137def302ecd0f810bc46b808a..b288ebe08b16204d97c4911106bd5ca57fb2b36b:/services/api/script/setup-new-user.rb diff --git a/services/api/script/setup-new-user.rb b/services/api/script/setup-new-user.rb index 19f5aeb7b7..af0de13b2c 100755 --- a/services/api/script/setup-new-user.rb +++ b/services/api/script/setup-new-user.rb @@ -21,10 +21,13 @@ If creating a new user record, require authentication from an OpenID \ with this OpenID prefix *and* a matching email address in order to \ claim the account. eos + opt :send_notification_email, <<-eos, default: 'true' +Send notification email after successfully setting up the user. + eos end log.level = (ENV['DEBUG'] || opts.debug) ? Logger::DEBUG : Logger::WARN - + if ARGV.count != 3 Trollop::die "required arguments are missing" end @@ -39,8 +42,8 @@ begin found_user = arv.user.get(uuid: user_arg) rescue Arvados::TransactionFailedError found = arv.user.list(where: {email: user_arg})[:items] - - if found.count == 0 + + if found.count == 0 if !user_arg.match(/\w\@\w+\.\w+/) abort "About to create new user, but #{user_arg.inspect} " + "does not look like an email address. Stop." @@ -55,10 +58,12 @@ end # Invoke user setup method if (found_user) user = arv.user.setup uuid: found_user[:uuid], repo_name: user_repo_name, - vm_uuid: vm_uuid, openid_prefix: opts.openid_prefix + vm_uuid: vm_uuid, openid_prefix: opts.openid_prefix, + send_notification_email: opts.send_notification_email else user = arv.user.setup user: {email: user_arg}, repo_name: user_repo_name, - vm_uuid: vm_uuid, openid_prefix: opts.openid_prefix + vm_uuid: vm_uuid, openid_prefix: opts.openid_prefix, + send_notification_email: opts.send_notification_email end log.info {"user uuid: " + user[:uuid]}