return 0;
}
-} // namespace rgw::swift
-
-boost::optional<std::string> RGWAccessControlPolicy_SWIFTAcct::to_str() const
+auto format_account_acl(const RGWAccessControlPolicy& policy)
+ -> std::optional<std::string>
{
+ const ACLOwner& owner = policy.get_owner();
+
std::vector<std::string> admin;
std::vector<std::string> readwrite;
std::vector<std::string> readonly;
/* Partition the grant map into three not-overlapping groups. */
- for (const auto& item : get_acl().get_grant_map()) {
+ for (const auto& item : policy.get_acl().get_grant_map()) {
const ACLGrant& grant = item.second;
const uint32_t perm = grant.get_permission().get_permissions();
/* If there is no grant to serialize, let's exit earlier to not return
* an empty JSON object which brakes the functional tests of Swift. */
if (admin.empty() && readwrite.empty() && readonly.empty()) {
- return boost::none;
+ return std::nullopt;
}
/* Serialize the groups. */
return oss.str();
}
+
+} // namespace rgw::swift
#include <string>
#include <include/types.h>
-#include <boost/optional.hpp>
#include "rgw_acl.h"
const std::string& acl_str,
RGWAccessControlPolicy& policy);
+/// Format the policy in terms of the X-Account-Access-Control string. Returns
+/// std::nullopt if there are no admin/read-write/read-only entries.
+auto format_account_acl(const RGWAccessControlPolicy& policy)
+ -> std::optional<std::string>;
+
} // namespace rgw::swift
class RGWAccessControlPolicy_SWIFT : public RGWAccessControlPolicy
class RGWAccessControlPolicy_SWIFTAcct : public RGWAccessControlPolicy
{
-public:
- boost::optional<std::string> to_str() const;
};
}
}
- /* Dump account ACLs */
- auto account_acls = policy.to_str();
+ /* Dump account ACLs, if any */
+ auto account_acls = rgw::swift::format_account_acl(policy);
if (account_acls) {
dump_header(s, "X-Account-Access-Control", std::move(*account_acls));
}