projects
/
arvados.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f8ba79b
)
Add optional notification for new users that are in the inactive state.
author
Ward Vandewege <ward@curoverse.com>
Wed, 23 Apr 2014 15:12:05 +0000
(11:12 -0400)
committer
Ward Vandewege <ward@curoverse.com>
Tue, 6 May 2014 15:10:13 +0000
(11:10 -0400)
services/api/app/mailers/admin_notifier.rb
patch
|
blob
|
history
services/api/app/models/user.rb
patch
|
blob
|
history
services/api/app/views/admin_notifier/new_inactive_user.text.erb
[new file with mode: 0644]
patch
|
blob
services/api/config/application.default.yml
patch
|
blob
|
history
diff --git
a/services/api/app/mailers/admin_notifier.rb
b/services/api/app/mailers/admin_notifier.rb
index 5de70053dcf0265258244ad252df341936334154..d291e86f9a746890c6fdfe5d4b0fea7c5cc03dbf 100644
(file)
--- a/
services/api/app/mailers/admin_notifier.rb
+++ b/
services/api/app/mailers/admin_notifier.rb
@@
-5,6
+5,13
@@
class AdminNotifier < ActionMailer::Base
self.generic_callback('after_create', model, *args)
end
self.generic_callback('after_create', model, *args)
end
+ def new_inactive_user(user)
+ @user = user
+ if not Rails.configuration.new_inactive_user_notification_recipients.empty? then
+ mail(to: Rails.configuration.new_inactive_user_notification_recipients, subject: 'New inactive user notification')
+ end
+ end
+
protected
def generic_callback(callback_type, model, *args)
protected
def generic_callback(callback_type, model, *args)
diff --git
a/services/api/app/models/user.rb
b/services/api/app/models/user.rb
index 81cae987a20d023f61d96a0ade93c9dd75d60c84..b6b7e67ff17b493b648f525b3d17fe5887950dc6 100644
(file)
--- a/
services/api/app/models/user.rb
+++ b/
services/api/app/models/user.rb
@@
-8,6
+8,7
@@
class User < ArvadosModel
before_update :prevent_inactive_admin
before_create :check_auto_admin
after_create :add_system_group_permission_link
before_update :prevent_inactive_admin
before_create :check_auto_admin
after_create :add_system_group_permission_link
+ after_create :send_admin_notifications
after_create AdminNotifier
has_many :authorized_keys, :foreign_key => :authorized_user_uuid, :primary_key => :uuid
after_create AdminNotifier
has_many :authorized_keys, :foreign_key => :authorized_user_uuid, :primary_key => :uuid
@@
-394,4
+395,10
@@
class User < ArvadosModel
head_uuid: self.uuid)
end
end
head_uuid: self.uuid)
end
end
+
+ def send_admin_notifications
+ if not self.is_active then
+ AdminNotifier.new_inactive_user(self).deliver
+ end
+ end
end
end
diff --git a/services/api/app/views/admin_notifier/new_inactive_user.text.erb
b/services/api/app/views/admin_notifier/new_inactive_user.text.erb
new file mode 100644
(file)
index 0000000..
98c7037
--- /dev/null
+++ b/
services/api/app/views/admin_notifier/new_inactive_user.text.erb
@@ -0,0
+1,7
@@
+
+A new user landed on the inactive user page:
+
+ <%= @user.full_name %> <<%= @user.email %>>
+
+Thanks,
+Your friendly Arvados robot.
diff --git
a/services/api/config/application.default.yml
b/services/api/config/application.default.yml
index 37bb1c380f9d48091c76ec167093c7b532709124..9966b95591ffe01595a41bb1c01e738a142e03c4 100644
(file)
--- a/
services/api/config/application.default.yml
+++ b/
services/api/config/application.default.yml
@@
-86,6
+86,7
@@
common:
admin_notifier_email_from: arvados@example.com
email_subject_prefix: "[ARVADOS] "
user_notifier_email_from: arvados@example.com
admin_notifier_email_from: arvados@example.com
email_subject_prefix: "[ARVADOS] "
user_notifier_email_from: arvados@example.com
+ new_inactive_user_notification_recipients: ''
# Visitors to the API server will be redirected to the workbench
workbench_address: https://workbench.local:3001/
# Visitors to the API server will be redirected to the workbench
workbench_address: https://workbench.local:3001/