[ARVADOS] updated: 0e560c4a9b3f1d46edcbd3fbc595beffc6efca47

git at public.curoverse.com git at public.curoverse.com
Mon Mar 24 14:19:17 EDT 2014


Summary of changes:
 apps/workbench/Gemfile                             |    9 +-
 apps/workbench/Gemfile.lock                        |   31 +++
 apps/workbench/README.rdoc                         |  261 --------------------
 apps/workbench/README.textile                      |   17 ++
 apps/workbench/app/assets/javascripts/editable.js  |    9 +
 .../api_client_authorizations_controller.rb        |    9 +-
 .../controllers/pipeline_templates_controller.rb   |    5 +-
 apps/workbench/app/models/arvados_api_client.rb    |   34 ++--
 apps/workbench/app/models/arvados_base.rb          |   27 ++-
 apps/workbench/app/models/arvados_resource_list.rb |    4 +
 .../app/views/application/_paging.html.erb         |    8 +-
 .../app/views/layouts/application.html.erb         |    2 +-
 apps/workbench/config/application.default.yml      |   12 +-
 .../config/environments/development.rb.example     |   20 --
 .../config/environments/production.rb.example      |   19 --
 apps/workbench/config/environments/test.rb.example |   19 --
 .../integration/api_client_authorizations_test.rb  |   11 +
 apps/workbench/test/integration/logins_test.rb     |   14 +
 .../test/integration/virtual_machines_test.rb      |   17 ++
 apps/workbench/test/integration_helper.rb          |   68 +++++
 doc/README                                         |   28 --
 doc/README.textile                                 |   52 ++++
 .../install-workbench-app.html.textile.liquid      |    2 -
 .../tutorials/tutorial-keep.html.textile.liquid    |    2 +-
 .../tutorial-new-pipeline.html.textile.liquid      |    2 +-
 sdk/cli/bin/crunch-job                             |   65 ++++-
 .../api/app/controllers/application_controller.rb  |    2 +-
 services/api/app/models/user.rb                    |   20 +-
 .../api/config/environments/development.rb.example |   39 ---
 .../api/config/environments/production.rb.example  |   42 ---
 services/api/config/environments/test.rb.example   |   40 ---
 services/api/script/crunch-dispatch.rb             |    2 +-
 services/api/script/rails                          |    4 -
 .../functional/arvados/v1/users_controller_test.rb |   98 +++++++-
 .../api/test/integration/collections_api_test.rb   |   12 +
 35 files changed, 465 insertions(+), 541 deletions(-)
 delete mode 100644 apps/workbench/README.rdoc
 create mode 100644 apps/workbench/README.textile
 create mode 100644 apps/workbench/test/integration/api_client_authorizations_test.rb
 create mode 100644 apps/workbench/test/integration/logins_test.rb
 create mode 100644 apps/workbench/test/integration/virtual_machines_test.rb
 create mode 100644 apps/workbench/test/integration_helper.rb
 delete mode 100644 doc/README
 create mode 100644 doc/README.textile

       via  0e560c4a9b3f1d46edcbd3fbc595beffc6efca47 (commit)
       via  87501e7bf8d4f2303cc25a00e93476784911438b (commit)
       via  968a749a6981074ba2159df70adde92b2e681263 (commit)
       via  a66dcf3c878be422520771e5bde3791248dba001 (commit)
       via  be04ef9fec4824bd09b290999f2f961379bd2b83 (commit)
       via  46f47b1e941e1471363a5d5480dbe4c68c18703a (commit)
       via  007446e69619bae44193f219b6d9b7fda31bafad (commit)
       via  a8537e43ce618b6f71e7195a3c8d08c5c8909ad1 (commit)
       via  6f1ecb3df81614ff2007088e55ca4ce51e6ae90b (commit)
       via  90f5ffab02a256828d43e6c04b511b47fa6ea2a9 (commit)
       via  9e3d3a05f976ff795418ebdcc480f1a7afd9d4de (commit)
       via  b8b693c0c8db03a251d51eb42b46ea1faf719b1a (commit)
       via  e5a9f73847bab2d27a9423bb1c237063f7739bef (commit)
       via  c19e37b1452cc7c8234f05f2b0f2ce3ae2f0dff6 (commit)
       via  2e2ce40b47b9e248805dcccc59baa77591c13d79 (commit)
       via  c6ff7517791480b4bf45de0a64553c97c5d4fd17 (commit)
       via  8fa6952e7aaf9afc6d72699b165a693962151a21 (commit)
       via  027953372c41b16b191d9a1124b82f1c21a759f9 (commit)
       via  f14fb304f537a3e006e4312f225c88217634eb6d (commit)
       via  81c6881710e5d2e21f44682455f176dd965684cd (commit)
       via  14ea55f217bbd7061fafc1fe69f4f453ad7c3e59 (commit)
       via  354367a4c824a1e44192f2ea9364fd9414162f4d (commit)
       via  c36fe93c282ef320e7e5f0f9182994b50f7e88d3 (commit)
       via  259c3b7b2e77b17590beef58b519f57a7d9b41e7 (commit)
       via  40f9e6c22b1a4f7cbe473bae2e4336ef23feb41a (commit)
       via  694e7cdb8bce9e18ca63fab78c3201232b8aab77 (commit)
       via  3e3ef3aec33b4374a0d5cdfdb52b233499f9eb90 (commit)
       via  d4f3fdcb1cb4eea905961228eb46e9c8203c719c (commit)
       via  46e1645bb91debb3e4ad98b82895ada5329e9351 (commit)
       via  df8de1bd9a517a1a3bfac0f8ab9ace41524d4b39 (commit)
       via  7c8f8fda0c43bc379995ebb0204112eccfb6d97d (commit)
       via  49016b4c5681cf819b3e42370e6e65c254cde4b4 (commit)
       via  31506905a346552d6ef7a0b100c5fd203da7c2d8 (commit)
       via  95e59f8e8c427bf199445a75102f1dfaeb4bf8a6 (commit)
       via  c50aa22b70789edf34fd72741f02f48ea138d5fe (commit)
       via  764a15cfda6fc6c612a64f9b8542c408afbda921 (commit)
       via  e348aa5023875dbbbd40a0dc2ee32ea6aee53edd (commit)
       via  5a5b2ae2ce1f5898bacb913459ecbc2d575733af (commit)
       via  36b981fd2ddc6c491a9da1c5410ce802ecb13e65 (commit)
       via  366c5db829a38cfceb5894a4af5ee4c3ec5901c8 (commit)
       via  32f8186abb06258d0cfe0f05e040365c4ec6b68a (commit)
      from  2bfc24e6eb5cbd51bbb2717cd70b02a25b008ae5 (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 0e560c4a9b3f1d46edcbd3fbc595beffc6efca47
Author: radhika chippada <radhika at radhika.curoverse>
Date:   Mon Mar 24 14:17:39 2014 -0400

    Include first link of a given type even on reruns of the setup method.

diff --git a/services/api/app/models/user.rb b/services/api/app/models/user.rb
index 54ea3e5..4858a9b 100644
--- a/services/api/app/models/user.rb
+++ b/services/api/app/models/user.rb
@@ -127,13 +127,13 @@ class User < ArvadosModel
       user = found
     end
 
-    # Check opd_login_perm
-    oid_login_perm = Link.where(tail_uuid: user[:email],
+    # Check oid_login_perm
+    oid_login_perms = Link.where(tail_uuid: user[:email],
                                 head_kind: 'arvados#user',
                                 link_class: 'permission',
                                 name: 'can_login')
 
-    if !oid_login_perm.any?
+    if !oid_login_perms.any?
       # create openid login permission
       oid_login_perm = Link.create(link_class: 'permission',
                                    name: 'can_login',
@@ -144,6 +144,8 @@ class User < ArvadosModel
                                    properties: login_perm_props
                                   )
       logger.info { "openid login permission: " + oid_login_perm[:uuid] }
+    else
+      oid_login_perm = oid_login_perms.first
     end
 
     # create repo, vm, and group links
@@ -299,12 +301,12 @@ class User < ArvadosModel
 
       logger.info { "vm uuid: " + vm[:uuid] }
 
-      login_perm = Link.where(tail_uuid: self.uuid,
+      login_perms = Link.where(tail_uuid: self.uuid,
                               head_uuid: vm[:uuid],
                               head_kind: 'arvados#virtualMachine',
                               link_class: 'permission',
                               name: 'can_login')
-      if !login_perm.any?
+      if !login_perms.any?
         login_perm = Link.create(tail_kind: 'arvados#user',
                                  tail_uuid: self.uuid,
                                  head_kind: 'arvados#virtualMachine',
@@ -313,6 +315,8 @@ class User < ArvadosModel
                                  name: 'can_login',
                                  properties: {username: repo_name})
         logger.info { "login permission: " + login_perm[:uuid] }
+      else
+        login_perm = login_perms.first
       end
 
       return login_perm
@@ -332,13 +336,13 @@ class User < ArvadosModel
     else
       logger.info { "\"All users\" group uuid: " + group[:uuid] }
 
-      group_perm = Link.where(tail_uuid: self.uuid,
+      group_perms = Link.where(tail_uuid: self.uuid,
                               head_uuid: group[:uuid],
                               head_kind: 'arvados#group',
                               link_class: 'permission',
                               name: 'can_read')
 
-      if !group_perm.any?
+      if !group_perms.any?
         group_perm = Link.create(tail_kind: 'arvados#user',
                                  tail_uuid: self.uuid,
                                  head_kind: 'arvados#group',
@@ -346,6 +350,8 @@ class User < ArvadosModel
                                  link_class: 'permission',
                                  name: 'can_read')
         logger.info { "group permission: " + group_perm[:uuid] }
+      else 
+        group_perm = group_perms.first
       end
 
       return group_perm
diff --git a/services/api/test/functional/arvados/v1/users_controller_test.rb b/services/api/test/functional/arvados/v1/users_controller_test.rb
index fa4676b..c364613 100644
--- a/services/api/test/functional/arvados/v1/users_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/users_controller_test.rb
@@ -501,6 +501,99 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
           'Expected PermissionDeniedError'
   end
 
+  test "setup user in multiple steps and verify response" do
+    authorize_with :admin
+
+    post :setup, {
+      openid_prefix: 'http://www.xyz.com/account',
+      user: {
+        email: "test at abc.com"
+      }
+    }
+
+    assert_response :success
+
+    response_items = JSON.parse(@response.body)['items']
+    created = response_items['user']
+
+    assert_not_nil created['uuid'], 'expected uuid for new user'
+    assert_not_nil created['email'], 'expected non-nil email'
+    assert_equal created['email'], 'test at abc.com', 'expected input email'
+
+    # verify links; 2 new links: oid_login_perm, and 'All users' group.
+    verify_num_links @all_links_at_start, 2
+
+    verify_link response_items, 'oid_login_perm', true, 'permission', 'can_login',
+        created['uuid'], created['email'], 'arvados#user', false, 'User'
+
+    verify_link response_items, 'group_perm', true, 'permission', 'can_read',
+        'All users', created['uuid'], 'arvados#group', true, 'Group'
+
+    verify_link response_items, 'repo_perm', false, 'permission', 'can_write',
+        'test_repo', created['uuid'], 'arvados#repository', true, 'Repository'
+
+    verify_link response_items, 'vm_login_perm', false, 'permission', 'can_login',
+        nil, created['uuid'], 'arvados#virtualMachine', false, 'VirtualMachine'
+
+   # invoke setup with a repository
+    post :setup, {
+      openid_prefix: 'http://www.xyz.com/account',
+      repo_name: 'new_repo',
+      uuid: created['uuid']
+    }
+
+    assert_response :success
+
+    response_items = JSON.parse(@response.body)['items']
+    created = response_items['user']
+
+    assert_equal 'test at abc.com', created['email'], 'expected input email'
+
+     # verify links
+    verify_link response_items, 'oid_login_perm', true, 'permission', 'can_login',
+        created['uuid'], created['email'], 'arvados#user', false, 'User'
+
+    verify_link response_items, 'group_perm', true, 'permission', 'can_read',
+        'All users', created['uuid'], 'arvados#group', true, 'Group'
+
+    verify_link response_items, 'repo_perm', true, 'permission', 'can_write',
+        'new_repo', created['uuid'], 'arvados#repository', true, 'Repository'
+
+    verify_link response_items, 'vm_login_perm', false, 'permission', 'can_login',
+        nil, created['uuid'], 'arvados#virtualMachine', false, 'VirtualMachine'
+
+    # invoke setup with a vm_uuid
+    post :setup, {
+      vm_uuid: @vm_uuid,
+      openid_prefix: 'http://www.xyz.com/account',
+      user: {
+        email: 'junk_email'
+      },
+      uuid: created['uuid']
+    }
+
+    assert_response :success
+
+    response_items = JSON.parse(@response.body)['items']
+    created = response_items['user']
+
+    assert_equal created['email'], 'test at abc.com', 'expected original email'
+
+    # verify links
+    verify_link response_items, 'oid_login_perm', true, 'permission', 'can_login',
+        created['uuid'], created['email'], 'arvados#user', false, 'User'
+
+    verify_link response_items, 'group_perm', true, 'permission', 'can_read',
+        'All users', created['uuid'], 'arvados#group', true, 'Group'
+
+    # since no repo name in input, we won't get any; even though user has one
+    verify_link response_items, 'repo_perm', false, 'permission', 'can_write',
+        'new_repo', created['uuid'], 'arvados#repository', true, 'Repository'
+
+    verify_link response_items, 'vm_login_perm', true, 'permission', 'can_login',
+        @vm_uuid, created['uuid'], 'arvados#virtualMachine', false, 'VirtualMachine'
+  end
+
   def verify_num_links (original_links, expected_additional_links)
     links_now = Link.all
     assert_equal original_links.size+expected_additional_links, Link.all.size,
@@ -512,18 +605,17 @@ class Arvados::V1::UsersControllerTest < ActionController::TestCase
     link = response_items[link_object_name]
 
     if !expect_link 
-      assert_nil link
+      assert_nil link, "Expected no link for #{link_object_name}"
       return
     end
 
-    assert_not_nil link
+    assert_not_nil link, "Expected link for #{link_object_name}"
 
     if fetch_object
       object = Object.const_get(class_name).where(name: head_uuid)
       assert [] != object, "expected #{class_name} with name #{head_uuid}"
       head_uuid = object.first[:uuid]
     end
-
     assert_equal link['link_class'], link_class,
         "did not find expected link_class for #{link_object_name}"
  

commit 87501e7bf8d4f2303cc25a00e93476784911438b
Merge: 2bfc24e 968a749
Author: radhika chippada <radhika at radhika.curoverse>
Date:   Mon Mar 24 09:02:04 2014 -0400

    Merge branch 'master' into 2187-enhance-user-setup


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


hooks/post-receive
-- 




More information about the arvados-commits mailing list