[ARVADOS] updated: 2.3.2-40-g0336418e5
Git user
git at public.arvados.org
Fri Feb 25 22:17:55 UTC 2022
Summary of changes:
services/api/app/models/api_client_authorization.rb | 7 ++++++-
.../v1/api_client_authorizations_controller_test.rb | 16 ++++++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
via 0336418e5249fca785893900909ea796b28b3393 (commit)
from 5ac037470d499e2ea545c5dc79f70d6f5ecef6a4 (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 0336418e5249fca785893900909ea796b28b3393
Author: Lucas Di Pentima <lucas.dipentima at curii.com>
Date: Fri Feb 25 16:29:12 2022 -0300
Merge branch '18801-aca-req-select-uuid'. Closes #18801
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima at curii.com>
diff --git a/services/api/app/models/api_client_authorization.rb b/services/api/app/models/api_client_authorization.rb
index 7c7ed759c..defa79ee2 100644
--- a/services/api/app/models/api_client_authorization.rb
+++ b/services/api/app/models/api_client_authorization.rb
@@ -35,7 +35,12 @@ class ApiClientAuthorization < ArvadosModel
UNLOGGED_CHANGES = ['last_used_at', 'last_used_by_ip_address', 'updated_at']
def assign_random_api_token
- self.api_token ||= rand(2**256).to_s(36)
+ begin
+ self.api_token ||= rand(2**256).to_s(36)
+ rescue ActiveModel::MissingAttributeError
+ # Ignore the case where self.api_token doesn't exist, which happens when
+ # the select=[...] is used.
+ end
end
def owner_uuid
diff --git a/services/api/test/functional/arvados/v1/api_client_authorizations_controller_test.rb b/services/api/test/functional/arvados/v1/api_client_authorizations_controller_test.rb
index bf407afcd..9c70f6f41 100644
--- a/services/api/test/functional/arvados/v1/api_client_authorizations_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/api_client_authorizations_controller_test.rb
@@ -203,4 +203,20 @@ class Arvados::V1::ApiClientAuthorizationsControllerTest < ActionController::Tes
get :current
assert_response 401
end
+
+ # Tests regression #18801
+ test "select param is respected in 'show' response" do
+ authorize_with :active
+ get :show, params: {
+ id: api_client_authorizations(:active).uuid,
+ select: ["uuid"],
+ }
+ assert_response :success
+ assert_raises ActiveModel::MissingAttributeError do
+ assigns(:object).api_token
+ end
+ assert_nil json_response["expires_at"]
+ assert_nil json_response["api_token"]
+ assert_equal api_client_authorizations(:active).uuid, json_response["uuid"]
+ end
end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list