Skip to content

Commit 6cb9df8

Browse files
authored
Merge pull request ceph#65366 from cbodley/wip-72847
rgw/admin: allow listing account's root users Reviewed-by: Adam Emerson <[email protected]>
2 parents d2185e7 + 772fbbb commit 6cb9df8

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/rgw/radosgw-admin/radosgw-admin.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9754,8 +9754,8 @@ int main(int argc, const char **argv)
97549754
std::string err_msg;
97559755
int ret = rgw::account::list_users(
97569756
dpp(), driver, op_state, path_prefix, marker,
9757-
max_entries_specified, max_entries, err_msg,
9758-
stream_flusher, null_yield);
9757+
max_entries_specified, max_entries, account_root,
9758+
err_msg, stream_flusher, null_yield);
97599759
if (ret < 0) {
97609760
cerr << "ERROR: " << err_msg << std::endl;
97619761
return -ret;

src/rgw/rgw_account.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ int stats(const DoutPrefixProvider* dpp,
487487
int list_users(const DoutPrefixProvider* dpp, rgw::sal::Driver* driver,
488488
AdminOpState& op_state, const std::string& path_prefix,
489489
const std::string& marker, bool max_entries_specified,
490-
int max_entries, std::string& err_msg,
490+
int max_entries, bool root_only, std::string& err_msg,
491491
RGWFormatterFlusher& flusher, optional_yield y)
492492
{
493493
int ret = 0;
@@ -541,6 +541,9 @@ int list_users(const DoutPrefixProvider* dpp, rgw::sal::Driver* driver,
541541
}
542542

543543
for (const auto& user : listing.users) {
544+
if (root_only && user.type != TYPE_ROOT) {
545+
continue; // skip non-root users if requested
546+
}
544547
encode_json("key", user.user_id, formatter);
545548
}
546549
flusher.flush();

src/rgw/rgw_account.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ int stats(const DoutPrefixProvider* dpp, rgw::sal::Driver* driver,
8686
int list_users(const DoutPrefixProvider* dpp, rgw::sal::Driver* driver,
8787
AdminOpState& op_state, const std::string& path_prefix,
8888
const std::string& marker, bool max_entries_specified,
89-
int max_entries, std::string& err_msg,
89+
int max_entries, bool root_only, std::string& err_msg,
9090
RGWFormatterFlusher& flusher, optional_yield y);
9191

9292
} // namespace rgw::account

0 commit comments

Comments
 (0)