rgw/notification: Filter topic list based on uid on radosgw-admin

Signed-off-by: kchheda3 <kchheda3@bloomberg.net>
This commit is contained in:
kchheda3 2023-08-22 00:12:07 +05:30
parent a17a33f97e
commit 2547d27b4b
2 changed files with 11 additions and 1 deletions

View File

@ -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:

View File

@ -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);
}