Merge branch '8784-dir-listings'
[arvados.git] / services / api / app / models / api_client_authorization.rb
index f7985a986afa304806cac1a551c1603615e92196..10c02cca25a576a113801b07865a75dfa8affa82 100644 (file)
@@ -1,3 +1,7 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
 class ApiClientAuthorization < ArvadosModel
   include HasUuid
   include KindAndEtag
@@ -61,7 +65,13 @@ class ApiClientAuthorization < ArvadosModel
   end
 
   def scopes_allow_request?(request)
-    scopes_allow? [request.request_method, request.path].join(' ')
+    method = request.request_method
+    if method == 'HEAD'
+      (scopes_allow?(['HEAD', request.path].join(' ')) ||
+       scopes_allow?(['GET', request.path].join(' ')))
+    else
+      scopes_allow?([method, request.path].join(' '))
+    end
   end
 
   def logged_attributes