4523: omit text type columns from searchable columns.
[arvados.git] / services / api / app / models / arvados_model.rb
index 823fd55435b7d4555395a64ab23dd519d5ed1917..8e98382bf070c53a8835eada595010421865a372 100644 (file)
@@ -60,8 +60,14 @@ class ArvadosModel < ActiveRecord::Base
     textonly_operator = !operator.match(/[<=>]/)
     self.columns.select do |col|
       case col.type
-      when :string, :text
+      when :string
         true
+      when :text
+        if operator == 'ilike'
+          false
+        else
+          true
+        end
       when :datetime, :integer, :boolean
         !textonly_operator
       else
@@ -110,7 +116,8 @@ class ArvadosModel < ActiveRecord::Base
     unless (owner_uuid == current_user.uuid or
             current_user.is_admin or
             (current_user.groups_i_can(:manage) & [uuid, owner_uuid]).any?)
-      if current_user.groups_i_can(:write).index(uuid)
+      if ((current_user.groups_i_can(:write) + [current_user.uuid]) &
+          [uuid, owner_uuid]).any?
         return [owner_uuid, current_user.uuid]
       else
         return [owner_uuid]