From: kchheda3 Date: Mon, 21 Aug 2023 18:42:07 +0000 (+0530) Subject: rgw/notification: Filter topic list based on uid on radosgw-admin X-Git-Tag: v19.0.0~512^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2547d27b4b0547f8eee58c30b078f0e43e73c2cc;p=ceph.git rgw/notification: Filter topic list based on uid on radosgw-admin Signed-off-by: kchheda3 --- diff --git a/doc/radosgw/notifications.rst b/doc/radosgw/notifications.rst index 1cc538432f3d..7f660dd76a3f 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 15bdaba87a56..e47a3b1d470a 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); }