[arvados] updated: 2.6.0-100-g9d3ace1fd

git repository hosting git at public.arvados.org
Thu May 4 23:09:36 UTC 2023


Summary of changes:
 services/api/app/controllers/application_controller.rb         | 10 +++++-----
 .../api/app/controllers/arvados/v1/containers_controller.rb    |  6 ++++++
 services/api/app/controllers/arvados/v1/users_controller.rb    |  6 ++++++
 3 files changed, 17 insertions(+), 5 deletions(-)

       via  9d3ace1fdba783134eb5557a9b28f8132df552de (commit)
      from  e3c25b992f96b34810c371aa75e30ba8ce40a639 (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 9d3ace1fdba783134eb5557a9b28f8132df552de
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Thu May 4 19:09:05 2023 -0400

    20470: select_for_klass checks for bogus prefixed fields
    
    Update comments
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/services/api/app/controllers/application_controller.rb b/services/api/app/controllers/application_controller.rb
index 1704eb913..b19155024 100644
--- a/services/api/app/controllers/application_controller.rb
+++ b/services/api/app/controllers/application_controller.rb
@@ -234,7 +234,7 @@ class ApplicationController < ActionController::Base
     # given class.
     sel.map do |column|
       sp = column.split(".")
-      if sp.length == 2 && sp[0] == model_class.table_name
+      if sp.length == 2 && sp[0] == model_class.table_name && model_class.selectable_attributes.include?(sp[1])
         sp[1]
       elsif model_class.selectable_attributes.include? column
         column
@@ -501,8 +501,8 @@ class ApplicationController < ActionController::Base
     # This is a little hacky but sometimes the fields the user wants
     # to selecting on are unrelated to the object being loaded here,
     # for example groups#contents, so filter the fields that will be
-    # used in find_objects_for_index and then reset it below.  In some
-    # cases, code that modifies the @select list needs to set
+    # used in find_objects_for_index and then reset afterwards.  In
+    # some cases, code that modifies the @select list needs to set
     # @preserve_select.
     @preserve_select = @select
     @select = select_for_klass(@select, self.model_class, false)
@@ -599,10 +599,10 @@ class ApplicationController < ActionController::Base
       :self_link => "",
       :offset => @offset,
       :limit => @limit,
-      :items => @objects.as_api_response(nil, {select: select_for_klass(@select, model_class)})
+      :items => @objects.as_api_response(nil, {select: @select})
     }
     if @extra_included
-      list[:included] = @extra_included.as_api_response(nil, {select: select_for_klass(@select, model_class)})
+      list[:included] = @extra_included.as_api_response(nil, {select: @select})
     end
     case params[:count]
     when nil, '', 'exact'
diff --git a/services/api/app/controllers/arvados/v1/containers_controller.rb b/services/api/app/controllers/arvados/v1/containers_controller.rb
index 507f9dcf1..acb61c6e6 100644
--- a/services/api/app/controllers/arvados/v1/containers_controller.rb
+++ b/services/api/app/controllers/arvados/v1/containers_controller.rb
@@ -50,6 +50,12 @@ class Arvados::V1::ContainersController < ApplicationController
     if action_name == 'lock' || action_name == 'unlock'
       # Avoid loading more fields than we need
       @objects = @objects.select(:id, :uuid, :state, :priority, :auth_uuid, :locked_by_uuid, :lock_count)
+      # This gets called from within find_object_by_uuid.
+      # find_object_by_uuid stores the original value of @select in
+      # @preserve_select, edits the value of @select, calls
+      # find_objects_for_index, then restores @select from the value
+      # of @preserve_select.  So if we want our updated value of
+      # @select here to stick, we have to set @preserve_select.
       @select = @preserve_select = %w(uuid state priority auth_uuid locked_by_uuid)
     elsif action_name == 'update_priority'
       # We're going to reload(lock: true) in the handler, which will
diff --git a/services/api/app/controllers/arvados/v1/users_controller.rb b/services/api/app/controllers/arvados/v1/users_controller.rb
index e0573a51c..ded86aa66 100644
--- a/services/api/app/controllers/arvados/v1/users_controller.rb
+++ b/services/api/app/controllers/arvados/v1/users_controller.rb
@@ -282,6 +282,12 @@ class Arvados::V1::UsersController < ApplicationController
       end
       @filters += [['is_active', '=', true]]
     end
+    # This gets called from within find_object_by_uuid.
+    # find_object_by_uuid stores the original value of @select in
+    # @preserve_select, edits the value of @select, calls
+    # find_objects_for_index, then restores @select from the value
+    # of @preserve_select.  So if we want our updated value of
+    # @select here to stick, we have to set @preserve_select.
     @preserve_select = @select
     super
   end

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list