[ARVADOS] updated: 45d8d010e15b0c4860102b78692ec8bc5b2ef158

git at public.curoverse.com git at public.curoverse.com
Mon Feb 16 11:32:52 EST 2015


Summary of changes:
 apps/workbench/app/controllers/users_controller.rb       | 12 +++++++++++-
 apps/workbench/test/controllers/users_controller_test.rb | 11 +++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)

       via  45d8d010e15b0c4860102b78692ec8bc5b2ef158 (commit)
      from  0cefa4c0f3c1b16884b04d6273bd8730166d69ba (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 45d8d010e15b0c4860102b78692ec8bc5b2ef158
Author: Radhika Chippada <radhika at curoverse.com>
Date:   Mon Feb 16 11:29:54 2015 -0500

    5189: include owned repositories in the list of repositories returned in manage_account.

diff --git a/apps/workbench/app/controllers/users_controller.rb b/apps/workbench/app/controllers/users_controller.rb
index 7dcd4cc..7443216 100644
--- a/apps/workbench/app/controllers/users_controller.rb
+++ b/apps/workbench/app/controllers/users_controller.rb
@@ -240,7 +240,13 @@ class UsersController < ApplicationController
               ['tail_uuid', '=', current_user.uuid],
               ['link_class', '=', 'permission'],
              ])
-    @my_repositories = Repository.where uuid: repo_links.collect(&:head_uuid)
+
+    @my_repositories = (Repository.where(uuid: repo_links.collect(&:head_uuid)) |
+                        Repository.where(owner_uuid: current_user.uuid)).
+                       uniq { |repo| repo.uuid }
+
+    owned_repositories = Repository.where(owner_uuid: current_user.uuid).collect(&:uuid)
+
     @repo_writable = {}
     repo_links.each do |link|
       if link.name.in? ['can_write', 'can_manage']
@@ -248,6 +254,10 @@ class UsersController < ApplicationController
       end
     end
 
+    owned_repositories.each do |repo|
+      @repo_writable[repo] = 'can_manage'
+    end
+
     # virtual machines the current user can login into
     @my_vm_logins = {}
     Link.where(tail_uuid: current_user.uuid,
diff --git a/apps/workbench/test/controllers/users_controller_test.rb b/apps/workbench/test/controllers/users_controller_test.rb
index ebec4a3..c1436da 100644
--- a/apps/workbench/test/controllers/users_controller_test.rb
+++ b/apps/workbench/test/controllers/users_controller_test.rb
@@ -41,6 +41,17 @@ class UsersControllerTest < ActionController::TestCase
     assert_includes editables, false, "should have a readonly repository"
   end
 
+  test "show repositories lists linked as well as owned repositories" do
+    get :manage_account, {}, session_for(:active)
+    assert_response :success
+    repos = assigns(:my_repositories)
+    assert repos
+    repo_writables = assigns(:repo_writable)
+    assert_not_empty repo_writables, "repo_writables should not be empty"
+    assert_includes repo_writables, api_fixture('repositories')['repository4']['uuid']  # writable by active
+    assert_includes repo_writables, api_fixture('repositories')['repository2']['uuid']  # owned by active
+  end
+
   test "request shell access" do
     user = api_fixture('users')['spectator']
 

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list