]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/admin: allow listing account's root users 65366/head
authorCasey Bodley <cbodley@redhat.com>
Wed, 3 Sep 2025 13:27:18 +0000 (09:27 -0400)
committerCasey Bodley <cbodley@redhat.com>
Wed, 3 Sep 2025 13:27:21 +0000 (09:27 -0400)
`radosgw-admin user list`, when given `--account-id` or
`--account-name`, lists only the users from that account

add support for the `--account-root` option to list only that account's
root users

Fixes: https://tracker.ceph.com/issues/72847
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/radosgw-admin/radosgw-admin.cc
src/rgw/rgw_account.cc
src/rgw/rgw_account.h

index 377665ef5b344849fcce213fa3fd904cbe4d5462..6713935b5dabbfdc18d4e6ba49b2646ce498b5c7 100644 (file)
@@ -9742,8 +9742,8 @@ next:
         std::string err_msg;
         int ret = rgw::account::list_users(
             dpp(), driver, op_state, path_prefix, marker,
-            max_entries_specified, max_entries, err_msg,
-            stream_flusher, null_yield);
+            max_entries_specified, max_entries, account_root,
+            err_msg, stream_flusher, null_yield);
         if (ret < 0)  {
           cerr << "ERROR: " << err_msg << std::endl;
           return -ret;
index fd9c479337ce0f5724ed7ff7e9f3fde8147f8375..5b9e54bbd02dca5bb907439a6f552c192f012ac8 100644 (file)
@@ -487,7 +487,7 @@ int stats(const DoutPrefixProvider* dpp,
 int list_users(const DoutPrefixProvider* dpp, rgw::sal::Driver* driver,
                AdminOpState& op_state, const std::string& path_prefix,
                const std::string& marker, bool max_entries_specified,
-               int max_entries, std::string& err_msg,
+               int max_entries, bool root_only, std::string& err_msg,
                RGWFormatterFlusher& flusher, optional_yield y)
 {
   int ret = 0;
@@ -541,6 +541,9 @@ int list_users(const DoutPrefixProvider* dpp, rgw::sal::Driver* driver,
     }
 
     for (const auto& user : listing.users) {
+      if (root_only && user.type != TYPE_ROOT) {
+        continue; // skip non-root users if requested
+      }
       encode_json("key", user.user_id, formatter);
     }
     flusher.flush();
index d3c9055f101436a548bd9dfe579dba7240bc4e31..9ebd81c100a1e0b5ebccc651b599380fe7c22ab7 100644 (file)
@@ -86,7 +86,7 @@ int stats(const DoutPrefixProvider* dpp, rgw::sal::Driver* driver,
 int list_users(const DoutPrefixProvider* dpp, rgw::sal::Driver* driver,
                AdminOpState& op_state, const std::string& path_prefix,
                const std::string& marker, bool max_entries_specified,
-               int max_entries, std::string& err_msg,
+               int max_entries, bool root_only, std::string& err_msg,
                RGWFormatterFlusher& flusher, optional_yield y);
 
 } // namespace rgw::account