From 2547d27b4b0547f8eee58c30b078f0e43e73c2cc Mon Sep 17 00:00:00 2001 From: kchheda3 Date: Tue, 22 Aug 2023 00:12:07 +0530 Subject: [PATCH] rgw/notification: Filter topic list based on uid on radosgw-admin Signed-off-by: kchheda3 --- doc/radosgw/notifications.rst | 2 +- src/rgw/rgw_admin.cc | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/doc/radosgw/notifications.rst b/doc/radosgw/notifications.rst index 1cc538432f3..7f660dd76a3 100644 --- a/doc/radosgw/notifications.rst +++ b/doc/radosgw/notifications.rst @@ -76,7 +76,7 @@ following command: .. prompt:: bash # - radosgw-admin topic list [--tenant={tenant}] + radosgw-admin topic list [--tenant={tenant}] [--uid={user}] Fetch the configuration of a specific topic by running the following command: diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 15bdaba87a5..e47a3b1d470 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -10511,6 +10511,16 @@ next: cerr << "ERROR: could not get topics: " << cpp_strerror(-ret) << std::endl; return -ret; } + if (!rgw::sal::User::empty(user)) { + for (auto it = result.topics.cbegin(); it != result.topics.cend();) { + const auto& topic = it->second; + if (user->get_id() != topic.user) { + result.topics.erase(it++); + } else { + ++it; + } + } + } encode_json("result", result, formatter.get()); formatter->flush(cout); }