Merge branch 'master' into 2681-new-inactive-user-notification
[arvados.git] / services / api / app / models / user.rb
index d6dd9dc8a86df40852f7b5bd459ab04b37f0d74f..8aec7670c5c92d63326eee09e294bbe5519b9ee8 100644 (file)
@@ -12,7 +12,7 @@ class User < ArvadosModel
   before_update :prevent_inactive_admin
   before_create :check_auto_admin
   after_create :add_system_group_permission_link
-  after_create AdminNotifier
+  after_create :send_admin_notifications
 
   has_many :authorized_keys, :foreign_key => :authorized_user_uuid, :primary_key => :uuid
 
@@ -402,4 +402,12 @@ class User < ArvadosModel
                   head_uuid: self.uuid)
     end
   end
+
+  # Send admin notifications
+  def send_admin_notifications
+    AdminNotifier.new_user(self).deliver
+    if not self.is_active then
+      AdminNotifier.new_inactive_user(self).deliver
+    end
+  end
 end