6588: Removed manage account button and updated tests and links. 6588-remove-manage-account-button
authorManoj <jonam33@gmail.com>
Wed, 29 Jul 2015 21:10:07 +0000 (17:10 -0400)
committerManoj <jonam33@gmail.com>
Wed, 29 Jul 2015 21:10:07 +0000 (17:10 -0400)
apps/workbench/app/controllers/users_controller.rb
apps/workbench/app/views/layouts/body.html.erb
apps/workbench/app/views/notifications/_ssh_key_notification.html.erb
apps/workbench/config/routes.rb
apps/workbench/test/controllers/users_controller_test.rb
apps/workbench/test/integration/application_layout_test.rb
apps/workbench/test/integration/user_manage_account_test.rb

index 6cf15a854244c4eeac4fc644db7f8bab46e004d2..b63e8ba9d306cf68a013142ac311d785c781b665 100644 (file)
@@ -312,53 +312,6 @@ class UsersController < ApplicationController
     end
   end
 
-  def manage_account
-    # repositories current user can read / write
-    repo_links = Link.
-      filter([['head_uuid', 'is_a', 'arvados#repository'],
-              ['tail_uuid', '=', current_user.uuid],
-              ['link_class', '=', 'permission'],
-             ])
-
-    owned_repositories = Repository.where(owner_uuid: current_user.uuid)
-
-    @my_repositories = (Repository.where(uuid: repo_links.collect(&:head_uuid)) |
-                        owned_repositories).
-                       uniq { |repo| repo.uuid }
-
-
-    @repo_writable = {}
-    repo_links.each do |link|
-      if link.name.in? ['can_write', 'can_manage']
-        @repo_writable[link.head_uuid] = link.name
-      end
-    end
-
-    owned_repositories.each do |repo|
-      @repo_writable[repo.uuid] = 'can_manage'
-    end
-
-    # virtual machines the current user can login into
-    @my_vm_logins = {}
-    Link.where(tail_uuid: current_user.uuid,
-               link_class: 'permission',
-               name: 'can_login').
-          each do |perm_link|
-            if perm_link.properties.andand[:username]
-              @my_vm_logins[perm_link.head_uuid] ||= []
-              @my_vm_logins[perm_link.head_uuid] << perm_link.properties[:username]
-            end
-          end
-    @my_virtual_machines = VirtualMachine.where(uuid: @my_vm_logins.keys)
-
-    # current user's ssh keys
-    @my_ssh_keys = AuthorizedKey.where(key_type: 'SSH', owner_uuid: current_user.uuid)
-
-    respond_to do |f|
-      f.html { render template: 'users/manage_account' }
-    end
-  end
-
   def add_ssh_key_popup
     respond_to do |format|
       format.html
index 4a17abb768021d10673c3987cce58d274fd6c71e..2820f83f5bc07557d3e27a033ebceb4fb5bac2a5 100644 (file)
@@ -62,8 +62,6 @@
                 <li role="menuitem"><a href="/manage_current_token" role="menuitem"><i class="fa fa-lg fa-ticket fa-fw"></i> My current token</a></li>
                 <li role="menuitem"><a href="/manage_ssh_keys" role="menuitem"><i class="fa fa-lg fa-key fa-fw"></i> My SSH keys</a></li>
 
-                <li role="menuitem"><a href="/manage_account" role="menuitem"><i class="fa fa-lg fa-key fa-fw"></i> Manage account</a></li>
-
                 <% if Rails.configuration.user_profile_form_fields %>
                   <li role="menuitem"><a href="/users/<%=current_user.uuid%>/profile" role="menuitem"><i class="fa fa-lg fa-user fa-fw"></i> Manage profile</a></li>
                 <% end %>
index 989db3daff21d66de26ca13477bd2f5520c0de0a..84c168ad00af6de7c305c9ea49a4ff54e3b752f3 100644 (file)
@@ -2,5 +2,5 @@
     <div>
       Hi, I noticed that you have not yet set up an SSH public key for use with Arvados.
       <%= link_to "Click here to set up an SSH public key for use with Arvados.",
-      "/manage_account", style: "font-weight: bold" %>
+      "/manage_ssh_keys", style: "font-weight: bold" %>
     </div>
index 86140cf072050bf73062019dffd2060e8767a1e7..603bb473518992719746038cde84b1b0955e2107 100644 (file)
@@ -51,7 +51,6 @@ ArvadosWorkbench::Application.routes.draw do
   get '/manage_repositories' => 'users#manage_repositories'
   get '/manage_current_token' => 'users#manage_current_token'
   get '/manage_ssh_keys' => 'users#manage_ssh_keys'
-  get '/manage_account' => 'users#manage_account'
   get "/add_ssh_key_popup" => 'users#add_ssh_key_popup', :as => :add_ssh_key_popup
   get "/add_ssh_key" => 'users#add_ssh_key', :as => :add_ssh_key
   resources :logs
index 6b9cd6efa647edd391d78ff79a6e8bbd429348c9..29d1d9daeda81ba0ab57b048540ec638b346024a 100644 (file)
@@ -32,7 +32,7 @@ class UsersControllerTest < ActionController::TestCase
   end
 
   test "show repositories with read, write, or manage permission" do
-    get :manage_account, {}, session_for(:active)
+    get :manage_repositories, {}, session_for(:active)
     assert_response :success
     repos = assigns(:my_repositories)
     assert repos
@@ -43,7 +43,7 @@ class UsersControllerTest < ActionController::TestCase
   end
 
   test "show repositories lists linked as well as owned repositories" do
-    get :manage_account, {}, session_for(:active)
+    get :manage_repositories, {}, session_for(:active)
     assert_response :success
     repos = assigns(:my_repositories)
     assert repos
index b14563568742622ec9d762985416e1a6e9c38b02..6eb54926c615cd03d7ed47bfe1794612f998c4a1 100644 (file)
@@ -50,7 +50,10 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
             assert page.has_no_link?('Sign agreements'), 'Found link - Sign agreements'
 
             assert_selector "a[href=\"/projects/#{user['uuid']}\"]", text: 'My home project'
-            assert page.has_link?('Manage account'), 'No link - Manage account'
+            assert page.has_link?('My virtual machines'), 'No link - My virtual machines'
+            assert page.has_link?('My repositories'), 'No link - My repositories'
+            assert page.has_link?('My current token'), 'No link - My current token'
+            assert page.has_link?('My SSH keys'), 'No link - My SSH keys'
 
             if profile_config
               assert page.has_link?('Manage profile'), 'No link - Manage profile'
@@ -59,7 +62,10 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
             end
           else
             assert_no_selector 'a', text: 'My home project'
-            assert page.has_no_link?('Manage account'), 'Found link - Manage account'
+            assert page.has_no_link?('My virtual machines'), 'No link - My virtual machines'
+            assert page.has_no_link?('My repositories'), 'No link - My repositories'
+            assert page.has_no_link?('My current token'), 'No link - My current token'
+            assert page.has_no_link?('My SSH keys'), 'No link - My SSH keys'
             assert page.has_no_link?('Manage profile'), 'Found link - Manage profile'
           end
           assert page.has_link?('Log out'), 'No link - Log out'
index c86ba0c83ef0ab95f81a1706274a884e88bdff78..4d1e4ade4379f0ee1110edf1202b2e5abbbac976 100644 (file)
@@ -110,7 +110,7 @@ class UserManageAccountTest < ActionDispatch::IntegrationTest
   end
 
   test "verify repositories for active user" do
-    visit page_with_token('active', '/manage_account')
+    visit page_with_token('active', '/manage_repositories')
 
     repos = [[api_fixture('repositories')['foo'], true, true],
              [api_fixture('repositories')['repository3'], false, false],
@@ -136,7 +136,7 @@ class UserManageAccountTest < ActionDispatch::IntegrationTest
 
   test "request shell access" do
     ActionMailer::Base.deliveries = []
-    visit page_with_token('spectator', '/manage_account')
+    visit page_with_token('spectator', '/manage_virtual_machines')
     assert_text 'You do not have access to any virtual machines'
     click_link 'Send request for shell access'
 
@@ -173,7 +173,7 @@ class UserManageAccountTest < ActionDispatch::IntegrationTest
   end
 
   test "create new repository" do
-    visit page_with_token("active_trustedclient", "/manage_account")
+    visit page_with_token("active_trustedclient", "/manage_repositories")
     click_on "Add new repository"
     within ".modal-dialog" do
       fill_in "Name", with: "workbenchtest"