[ARVADOS] created: 378c32cf74c1c9d559e3b8e559a9dcdc77ff2017

git at public.curoverse.com git at public.curoverse.com
Wed Feb 4 13:29:59 EST 2015


        at  378c32cf74c1c9d559e3b8e559a9dcdc77ff2017 (commit)


commit 378c32cf74c1c9d559e3b8e559a9dcdc77ff2017
Author: Radhika Chippada <radhika at curoverse.com>
Date:   Wed Feb 4 13:29:17 2015 -0500

    4951: send mail to request shell access to user

diff --git a/apps/workbench/app/controllers/users_controller.rb b/apps/workbench/app/controllers/users_controller.rb
index 68b082b..6d9d8cb 100644
--- a/apps/workbench/app/controllers/users_controller.rb
+++ b/apps/workbench/app/controllers/users_controller.rb
@@ -302,6 +302,15 @@ class UsersController < ApplicationController
     end
   end
 
+  def request_shell_access
+    logger.warn "request_access: #{params.inspect}"
+    params['request_url'] = request.url
+    respond_to do |format|
+      RequestShellAccessReporter.send_request(current_user, params).deliver
+      format.js {render nothing: true}
+    end
+  end
+
   protected
 
   def find_current_links user
diff --git a/apps/workbench/app/mailers/request_shell_access_reporter.rb b/apps/workbench/app/mailers/request_shell_access_reporter.rb
new file mode 100644
index 0000000..0195573
--- /dev/null
+++ b/apps/workbench/app/mailers/request_shell_access_reporter.rb
@@ -0,0 +1,11 @@
+class RequestShellAccessReporter < ActionMailer::Base
+  default from: Rails.configuration.email_from
+  default to: Rails.configuration.support_email_address
+
+  def send_request(user, params)
+    @user = user
+    @params = params
+    subject = "Shell account request from #{user.full_name} (#{user.email}, #{user.uuid})"
+    mail(subject: subject)
+  end
+end
diff --git a/apps/workbench/app/views/request_shell_access_reporter/send_request.text.erb b/apps/workbench/app/views/request_shell_access_reporter/send_request.text.erb
new file mode 100644
index 0000000..ef80ebb
--- /dev/null
+++ b/apps/workbench/app/views/request_shell_access_reporter/send_request.text.erb
@@ -0,0 +1,8 @@
+Shell account request from <%=@user.full_name%> (<%=@user.email%>, <%=@user.uuid%>)
+
+Details of the request:
+Full name: <%=@user.full_name%>
+Email address: <%=@user.email%>
+User's UUID: <%=@user.uuid%>
+User setup URL: <%= link_to('setup user', @params['request_url'].gsub('/request_shell_access', '#Admin')) %>
+
diff --git a/apps/workbench/app/views/users/_manage_virtual_machines.html.erb b/apps/workbench/app/views/users/_manage_virtual_machines.html.erb
index c6190ec..9c40d70 100644
--- a/apps/workbench/app/views/users/_manage_virtual_machines.html.erb
+++ b/apps/workbench/app/views/users/_manage_virtual_machines.html.erb
@@ -6,7 +6,9 @@
   </p>
 
   <% if !@my_virtual_machines.any? %>
-    You do not seem to have access to any virtual machines. If you would like to request access, please contact your system admin.
+    You do not have access to any virtual machines. Many of the Arvados features depend on having shell access to a hosted VM.
+      <%= link_to 'Request shell access', request_shell_access_user_url(id: current_user.uuid),
+                        {class: 'btn btn-xs btn-primary', :remote => true}  %>
   <% else %>
     <table class="table virtual-machines-table">
       <colgroup>
diff --git a/apps/workbench/config/application.default.yml b/apps/workbench/config/application.default.yml
index dd30641..3366fdc 100644
--- a/apps/workbench/config/application.default.yml
+++ b/apps/workbench/config/application.default.yml
@@ -185,6 +185,9 @@ common:
   issue_reporter_email_to: arvados at example.com
   support_email_address: arvados at example.com
 
+  # generic issue email from
+  email_from: arvados at example.com
+
   # filename suffixes for which view icon would be shown in collection show page
   filename_suffixes_with_view_icon: [txt, gif, jpeg, jpg, png, html, htm, pdf]
 
diff --git a/apps/workbench/config/routes.rb b/apps/workbench/config/routes.rb
index 6b29d05..9225fe1 100644
--- a/apps/workbench/config/routes.rb
+++ b/apps/workbench/config/routes.rb
@@ -39,6 +39,7 @@ ArvadosWorkbench::Application.routes.draw do
     post 'unsetup', :on => :member
     get 'setup_popup', :on => :member
     get 'profile', :on => :member
+    get 'request_shell_access', :on => :member
   end
   get '/manage_account' => 'users#manage_account'
   get "/add_ssh_key_popup" => 'users#add_ssh_key_popup', :as => :add_ssh_key_popup

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list