[ARVADOS] updated: 33b9b5e6b376194ea68e628ab74256274172d130
git at public.curoverse.com
git at public.curoverse.com
Sat Aug 23 11:02:42 EDT 2014
Summary of changes:
services/api/app/models/user.rb | 14 ++++----------
services/api/test/unit/user_test.rb | 19 ++++++++++---------
2 files changed, 14 insertions(+), 19 deletions(-)
via 33b9b5e6b376194ea68e628ab74256274172d130 (commit)
via 38f75fbc29cd41cd0fd79756a70c254f2eea7fb5 (commit)
from c808c34df9a699491f745f5666b787788a649a16 (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 33b9b5e6b376194ea68e628ab74256274172d130
Author: radhika <radhika at curoverse.com>
Date: Sat Aug 23 11:00:29 2014 -0400
3153: change variable name in test from valid_username to ok_to_auto_setup
diff --git a/services/api/app/models/user.rb b/services/api/app/models/user.rb
index 836b6a6..9bdd14d 100644
--- a/services/api/app/models/user.rb
+++ b/services/api/app/models/user.rb
@@ -433,7 +433,7 @@ class User < ArvadosModel
blacklisted_usernames = Rails.configuration.auto_setup_name_blacklist
if blacklisted_usernames.include?(username)
- return true;
+ return true
elsif !(/^[a-zA-Z][-._a-zA-Z0-9]{0,30}[a-zA-Z0-9]$/.match(username))
return true
else
diff --git a/services/api/test/unit/user_test.rb b/services/api/test/unit/user_test.rb
index 9b03b43..7de3fae 100644
--- a/services/api/test/unit/user_test.rb
+++ b/services/api/test/unit/user_test.rb
@@ -193,7 +193,7 @@ class UserTest < ActiveSupport::TestCase
[true, 'active-notify at example.com', 'inactive-notify at example.com', 'r00t at example.com', false, false, true], # no repo or vm login, so format not checked
[true, 'active-notify at example.com', 'inactive-notify at example.com', 'r00t at example.com', true, false, true], # valid format
- ].each do |active, active_recipients, inactive_recipients, email, auto_setup_vm, auto_setup_repo, valid_username|
+ ].each do |active, active_recipients, inactive_recipients, email, auto_setup_vm, auto_setup_repo, ok_to_auto_setup|
test "create new user with auto setup #{active} #{email} #{auto_setup_vm} #{auto_setup_repo}" do
auto_setup_new_users = Rails.configuration.auto_setup_new_users
auto_setup_new_users_with_vm_uuid = Rails.configuration.auto_setup_new_users_with_vm_uuid
@@ -212,7 +212,7 @@ class UserTest < ActiveSupport::TestCase
Rails.configuration.auto_setup_new_users_with_repository = auto_setup_repo
- create_user_and_verify_setup_and_notifications active, active_recipients, inactive_recipients, email, valid_username
+ create_user_and_verify_setup_and_notifications active, active_recipients, inactive_recipients, email, ok_to_auto_setup
ensure
Rails.configuration.auto_setup_new_users = auto_setup_new_users
Rails.configuration.auto_setup_new_users_with_vm_uuid = auto_setup_new_users_with_vm_uuid
@@ -444,7 +444,7 @@ class UserTest < ActiveSupport::TestCase
end
end
- def create_user_and_verify_setup_and_notifications (active, active_recipients, inactive_recipients, email, valid_username)
+ def create_user_and_verify_setup_and_notifications (active, active_recipients, inactive_recipients, email, ok_to_auto_setup)
Rails.configuration.new_user_notification_recipients = active_recipients
Rails.configuration.new_inactive_user_notification_recipients = inactive_recipients
@@ -464,7 +464,7 @@ class UserTest < ActiveSupport::TestCase
g[:uuid].match /-f+$/
end.first
- if !Rails.configuration.auto_setup_new_users || !valid_username
+ if !Rails.configuration.auto_setup_new_users || !ok_to_auto_setup
# verify that the user is not added to "All groups" by auto_setup
verify_link_exists false, group[:uuid], user.uuid, 'permission', 'can_read', nil, nil
@@ -524,7 +524,7 @@ class UserTest < ActiveSupport::TestCase
new_user_email_subject = "#{Rails.configuration.email_subject_prefix}New user created notification"
if Rails.configuration.auto_setup_new_users
- new_user_email_subject = valid_username ? "#{Rails.configuration.email_subject_prefix}New user created and setup notification" :
+ new_user_email_subject = ok_to_auto_setup ? "#{Rails.configuration.email_subject_prefix}New user created and setup notification" :
"#{Rails.configuration.email_subject_prefix}New user created, but not setup notification"
end
@@ -549,7 +549,7 @@ class UserTest < ActiveSupport::TestCase
if active
assert_nil new_inactive_user_email, 'Expected no inactive user email after setting up active user'
- if (not active_recipients.empty?) && valid_username then
+ if (not active_recipients.empty?) && ok_to_auto_setup then
assert_not_nil new_user_email, 'Expected new user email after setup'
assert_equal Rails.configuration.user_notifier_email_from, new_user_email.from[0]
assert_equal active_recipients, new_user_email.to[0]
commit 38f75fbc29cd41cd0fd79756a70c254f2eea7fb5
Author: radhika <radhika at curoverse.com>
Date: Sat Aug 23 10:50:43 2014 -0400
3153: directly invoke setup method during auto-setup
diff --git a/services/api/app/models/user.rb b/services/api/app/models/user.rb
index b3c88f5..836b6a6 100644
--- a/services/api/app/models/user.rb
+++ b/services/api/app/models/user.rb
@@ -442,15 +442,9 @@ class User < ArvadosModel
end
# setup user
- if !Rails.configuration.auto_setup_new_users_with_vm_uuid &&
- !Rails.configuration.auto_setup_new_users_with_repository
- oid_login_perm = create_oid_login_perm Rails.configuration.default_openid_prefix
- group_perm = create_user_group_link
- else
- setup_repo_vm_links(username,
- Rails.configuration.auto_setup_new_users_with_vm_uuid,
- Rails.configuration.default_openid_prefix)
- end
+ setup_repo_vm_links(username,
+ Rails.configuration.auto_setup_new_users_with_vm_uuid,
+ Rails.configuration.default_openid_prefix)
end
# Find a username that starts with the given string and does not collide
diff --git a/services/api/test/unit/user_test.rb b/services/api/test/unit/user_test.rb
index 30ca254..9b03b43 100644
--- a/services/api/test/unit/user_test.rb
+++ b/services/api/test/unit/user_test.rb
@@ -141,10 +141,11 @@ class UserTest < ActiveSupport::TestCase
[false, [], [], nil, true, true, false],
[false, [], [], 'arvados', true, true, false],
- [false, [], [], 'arvados', false, false, true], # since we are not creating repo and vm login, this blaklisted name is not a problem
+ [false, [], [], 'arvados', true, false, false], # blacklisted username
+ [false, [], [], 'arvados', false, false, true], # since we are not creating repo and vm login, this blacklisted name is not a problem
- [false, [], [], 'arvados at example.com', false, false, true], # since we are not creating repo and vm login, this blaklisted name is not a problem
- [false, [], [], 'arva.dos at example.com', true, true, true], # not blaklisted name
+ [false, [], [], 'arvados at example.com', false, false, true], # since we are not creating repo and vm login, this blacklisted name is not a problem
+ [true, 'active-notify at example.com', 'inactive-notify at example.com', 'arvados at ex.com', false, false, true], # since we are not creating repo and vm login, this blacklisted name is not a problem
[true, 'active-notify at example.com', 'inactive-notify at example.com', 'root at example.com', true, false, false], # blacklisted name after removing -._ characters
[true, 'active-notify at example.com', 'inactive-notify at example.com', 'roo_t at example.com', false, true, true], # not blacklisted name
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list