X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/87275ec769831e04982a714049ee9d67b6342d68..9090c60b28de593b8bb2ce606a9ab35b62b57608:/services/api/app/models/user.rb diff --git a/services/api/app/models/user.rb b/services/api/app/models/user.rb index eb181c3856..742db4c9b0 100644 --- a/services/api/app/models/user.rb +++ b/services/api/app/models/user.rb @@ -10,7 +10,7 @@ class User < ArvadosModel has_many :api_client_authorizations validates(:username, format: { - with: /^[A-Za-z][A-Za-z0-9]*$/, + with: /\A[A-Za-z][A-Za-z0-9]*\z/, message: "must begin with a letter and contain only alphanumerics", }, uniqueness: true, @@ -166,8 +166,11 @@ class User < ArvadosModel WHERE user_uuid = $1 AND target_owner_uuid IS NOT NULL GROUP BY target_owner_uuid', + # "name" arg is a query label that appears in logs: "group_permissions for #{uuid}", - [[nil, uuid]]).rows.each do |group_uuid, max_p_val| + # "binds" arg is an array of [col_id, value] for '$1' vars: + [[nil, uuid]], + ).rows.each do |group_uuid, max_p_val| group_perms[group_uuid] = PERMS_FOR_VAL[max_p_val.to_i] end Rails.cache.write "groups_for_user_#{self.uuid}", group_perms @@ -472,9 +475,9 @@ class User < ArvadosModel # Send admin notifications def send_admin_notifications - AdminNotifier.new_user(self).deliver + AdminNotifier.new_user(self).deliver_now if not self.is_active then - AdminNotifier.new_inactive_user(self).deliver + AdminNotifier.new_inactive_user(self).deliver_now end end @@ -499,7 +502,7 @@ class User < ArvadosModel if self.prefs_changed? if self.prefs_was.andand.empty? || !self.prefs_was.andand['profile'] profile_notification_address = Rails.configuration.user_profile_notification_address - ProfileNotifier.profile_created(self, profile_notification_address).deliver if profile_notification_address + ProfileNotifier.profile_created(self, profile_notification_address).deliver_now if profile_notification_address end end end