]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/s3control: skip account id check for admin users 64293/head
authorCasey Bodley <cbodley@redhat.com>
Tue, 26 May 2026 16:03:48 +0000 (12:03 -0400)
committerCasey Bodley <cbodley@redhat.com>
Tue, 26 May 2026 16:03:50 +0000 (12:03 -0400)
allow access to admin users that don't belong to the requested account.
this is also necessary for multisite, where requests are forwarded to
the metadata master as the multisite system user instead of the original
requester

Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_rest_s3control.cc

index 89b97a67fae92ecdf43c53b4f1406f54872607b5..01b9285139475fb44788c366f36f7387cb9fec39 100644 (file)
@@ -52,13 +52,16 @@ static int get_account_id(req_state* s, rgw_account_id& account_id)
     return -EINVAL;
   }
 
-  const auto& account = s->auth.identity->get_account();
-  if (!account) {
-    return -ERR_METHOD_NOT_ALLOWED;
-  }
-  if (account_id != account->id) {
-    s->err.message = "x-amz-account-id must match the requester";
-    return -EINVAL;
+  if (!s->auth.identity->is_admin()) {
+    // verify that the requester belongs to the specified account
+    const auto& account = s->auth.identity->get_account();
+    if (!account) {
+      return -ERR_METHOD_NOT_ALLOWED;
+    }
+    if (account_id != account->id) {
+      s->err.message = "x-amz-account-id must match the requester";
+      return -EINVAL;
+    }
   }
   return 0;
 }