]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/iam: add helper rgw::account::root_arn()
authorCasey Bodley <cbodley@redhat.com>
Thu, 16 Apr 2026 17:58:13 +0000 (13:58 -0400)
committerCasey Bodley <cbodley@redhat.com>
Wed, 3 Jun 2026 19:41:30 +0000 (15:41 -0400)
we need account root arns for various permission checks, and don't have
a consistent way to construct them

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit ccdbebd925b77eb7c5d0ba9a3a175642babcf291)

Conflicts:
src/rgw/rgw_rest_iam_account.cc  does not exist on tentacle

src/rgw/rgw_account.cc
src/rgw/rgw_account.h

index fd9c479337ce0f5724ed7ff7e9f3fde8147f8375..6efd9a9e84dd30ab959a9d83ee9881c1a7a3b4ac 100644 (file)
@@ -21,6 +21,7 @@
 #include "common/random_string.h"
 #include "common/utf8.h"
 
+#include "rgw_arn.h"
 #include "rgw_oidc_provider.h"
 #include "rgw_quota.h"
 #include "rgw_role.h"
@@ -101,6 +102,12 @@ bool validate_name(std::string_view name, std::string* err_msg)
   return true;
 }
 
+ARN root_arn(std::string id)
+{
+  const std::string region; // empty
+  return {Partition::aws, Service::iam, region, std::move(id), "root"};
+}
+
 
 int create(const DoutPrefixProvider* dpp,
            rgw::sal::Driver* driver,
index d3c9055f101436a548bd9dfe579dba7240bc4e31..f1ebf576cac180bb1688430c4dbe48c6f39e58f5 100644 (file)
@@ -27,6 +27,8 @@ class DoutPrefixProvider;
 class RGWFormatterFlusher;
 class optional_yield;
 
+namespace rgw { class ARN; }
+
 namespace rgw::account {
 
 /// generate a randomized account id in a specific format
@@ -38,6 +40,9 @@ bool validate_id(std::string_view id, std::string* err_msg = nullptr);
 /// check an account name for any invalid characters
 bool validate_name(std::string_view name, std::string* err_msg = nullptr);
 
+/// construct the account root arn
+ARN root_arn(std::string account_id);
+
 
 struct AdminOpState {
   std::string account_id;