14584: Remove runtime_user_uuid and runtime_auth_scopes checks for reuse.
[arvados.git] / services / api / app / models / container.rb
index 6ef9d7cbd338661a687d6a529574d09f8f4f7bc5..bd586907ee2eaf205616251be126bc7cf9c94b09 100644 (file)
@@ -224,26 +224,10 @@ class Container < ArvadosModel
         next
       end
 
-      pdh = mount['portable_data_hash']
-      uuid = mount['uuid']
+      uuid = mount.delete 'uuid'
 
-      # Prioritize PDH over UUID for mount selection
-      if not pdh.nil?
-        c = Collection.
-          readable_by(current_user).
-          where(portable_data_hash: pdh)
-        if c.count > 0
-          if uuid && c.where(uuid: uuid).count == 0
-            raise ArgumentError.new "cannot mount collection #{uuid.inspect}: current portable_data_hash #{pdh.inspect} does not match #{c.first.portable_data_hash.inspect} in request"
-          end
-          # mount.delete 'uuid'
-          next
-        end
-        raise ArgumentError.new "cannot mount collection #{pdh.inspect}: not found"
-      end
-
-      # PDH not supplied, try by UUID
-      if uuid
+      if mount['portable_data_hash'].nil? and !uuid.nil?
+        # PDH not supplied, try by UUID
         c = Collection.
           readable_by(current_user).
           where(uuid: uuid).
@@ -295,14 +279,6 @@ class Container < ArvadosModel
     candidates = candidates.where_serialized(:runtime_constraints, resolve_runtime_constraints(attrs[:runtime_constraints]), md5: true)
     log_reuse_info(candidates) { "after filtering on runtime_constraints #{attrs[:runtime_constraints].inspect}" }
 
-    candidates = candidates.where('runtime_user_uuid = ? or (runtime_user_uuid is NULL and runtime_auth_scopes is NULL)',
-                                  attrs[:runtime_user_uuid])
-    log_reuse_info(candidates) { "after filtering on runtime_user_uuid #{attrs[:runtime_user_uuid].inspect}" }
-
-    candidates = candidates.where('runtime_auth_scopes = ? or (runtime_user_uuid is NULL and runtime_auth_scopes is NULL)',
-                                  SafeJSON.dump(attrs[:runtime_auth_scopes].sort))
-    log_reuse_info(candidates) { "after filtering on runtime_auth_scopes #{attrs[:runtime_auth_scopes].inspect}" }
-
     log_reuse_info { "checking for state=Complete with readable output and log..." }
 
     select_readable_pdh = Collection.