[ARVADOS] updated: c7ee5e02cae78d3edff6ed393d776c4995441896

git at public.curoverse.com git at public.curoverse.com
Fri May 30 10:48:13 EDT 2014


Summary of changes:
 services/api/app/models/arvados_model.rb  |  2 +-
 services/api/test/fixtures/links.yml      | 14 ++++++++++++++
 services/api/test/unit/permission_test.rb | 14 ++++++++++++++
 3 files changed, 29 insertions(+), 1 deletion(-)

       via  c7ee5e02cae78d3edff6ed393d776c4995441896 (commit)
      from  ffe3cdbc8c37e2b4a4e3ea4f67c1c9ca5d81e2ed (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 c7ee5e02cae78d3edff6ed393d776c4995441896
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri May 30 10:45:00 2014 -0400

    2931: Remove {dependent: :destroy} in ArvadosModel. HasUuid does that now. closes #2931

diff --git a/services/api/app/models/arvados_model.rb b/services/api/app/models/arvados_model.rb
index 9700dd1..a6c9d31 100644
--- a/services/api/app/models/arvados_model.rb
+++ b/services/api/app/models/arvados_model.rb
@@ -27,7 +27,7 @@ class ArvadosModel < ActiveRecord::Base
   # Note: This only returns permission links. It does not account for
   # permissions obtained via user.is_admin or
   # user.uuid==object.owner_uuid.
-  has_many :permissions, :foreign_key => :head_uuid, :class_name => 'Link', :primary_key => :uuid, :conditions => "link_class = 'permission'", dependent: :destroy
+  has_many :permissions, :foreign_key => :head_uuid, :class_name => 'Link', :primary_key => :uuid, :conditions => "link_class = 'permission'"
 
   class PermissionDeniedError < StandardError
     def http_status
diff --git a/services/api/test/fixtures/links.yml b/services/api/test/fixtures/links.yml
index a7821aa..fe77407 100644
--- a/services/api/test/fixtures/links.yml
+++ b/services/api/test/fixtures/links.yml
@@ -403,3 +403,17 @@ multilevel_collection_1_readable_by_active:
   name: can_read
   head_uuid: 1fd08fc162a5c6413070a8bd0bffc818+150
   properties: {}
+
+bug2931_link_with_null_head_uuid:
+  uuid: zzzzz-o0j2j-uru66qok2wruasb
+  owner_uuid: zzzzz-tpzed-000000000000000
+  created_at: 2014-05-30 14:30:00.184389725 Z
+  modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
+  modified_by_user_uuid: zzzzz-tpzed-000000000000000
+  modified_at: 2014-05-30 14:30:00.184019565 Z
+  updated_at: 2014-05-30 14:30:00.183829316 Z
+  link_class: permission
+  name: bug2931
+  tail_uuid: ~
+  head_uuid: ~
+  properties: {}
diff --git a/services/api/test/unit/permission_test.rb b/services/api/test/unit/permission_test.rb
index c8e00bb..6e96dcc 100644
--- a/services/api/test/unit/permission_test.rb
+++ b/services/api/test/unit/permission_test.rb
@@ -14,4 +14,18 @@ class PermissionTest < ActiveSupport::TestCase
                             name: 'can_manage')
     assert perm_link.save, "should give myself permission on my own object"
   end
+
+  test "Delete permission links when deleting an object" do
+    set_user_from_auth :active_trustedclient
+
+    ob = Specimen.create!
+    Link.create!(tail_uuid: users(:active).uuid,
+                 head_uuid: ob.uuid,
+                 link_class: 'permission',
+                 name: 'can_manage')
+    ob_uuid = ob.uuid
+    assert ob.destroy, "Could not destroy object with 1 permission link"
+    assert_empty(Link.where(head_uuid: ob_uuid),
+                 "Permission link was not deleted when object was deleted")
+  end
 end

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list