From 2ac0daad1cb7daca8397206d2be693b615d87df2 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Thu, 16 Nov 2023 14:05:36 -0500 Subject: [PATCH] rgw/acl/swift: remove RGWAccessControlPolicy subclasses Signed-off-by: Casey Bodley --- src/rgw/rgw_acl_swift.h | 19 ++++--------------- src/rgw/rgw_op.cc | 4 ++-- src/rgw/rgw_rest_swift.cc | 17 ++++++----------- 3 files changed, 12 insertions(+), 28 deletions(-) diff --git a/src/rgw/rgw_acl_swift.h b/src/rgw/rgw_acl_swift.h index 9eeb9cb6cae..a16bea894db 100644 --- a/src/rgw/rgw_acl_swift.h +++ b/src/rgw/rgw_acl_swift.h @@ -3,15 +3,12 @@ #pragma once -#include -#include #include -#include +#include "rgw_sal_fwd.h" +#include "rgw_user_types.h" - -#include "rgw_acl.h" - -class RGWUserCtl; +class DoutPrefixProvider; +class RGWAccessControlPolicy; namespace rgw::swift { @@ -49,11 +46,3 @@ auto format_account_acl(const RGWAccessControlPolicy& policy) -> std::optional; } // namespace rgw::swift - -class RGWAccessControlPolicy_SWIFT : public RGWAccessControlPolicy -{ -}; - -class RGWAccessControlPolicy_SWIFTAcct : public RGWAccessControlPolicy -{ -}; diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 593d1598aef..cbc13d593f1 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -519,9 +519,9 @@ int rgw_build_bucket_policies(const DoutPrefixProvider *dpp, rgw::sal::Driver* d * the Swift's infrastructure that don't really need req_state::user. * Typical example here is the implementation of /info. */ if (!s->user->get_id().empty()) { - s->user_acl = std::make_unique(); + s->user_acl = std::make_unique(); } - s->bucket_acl = std::make_unique(); + s->bucket_acl = std::make_unique(); } else { s->bucket_acl = std::make_unique(); } diff --git a/src/rgw/rgw_rest_swift.cc b/src/rgw/rgw_rest_swift.cc index a752e827b12..55ebac5137c 100644 --- a/src/rgw/rgw_rest_swift.cc +++ b/src/rgw/rgw_rest_swift.cc @@ -92,7 +92,7 @@ static void dump_account_metadata(req_state * const s, /* const */map& attrs, const RGWQuotaInfo& quota, int32_t max_buckets, - const RGWAccessControlPolicy_SWIFTAcct &policy) + const RGWAccessControlPolicy& policy) { /* Adding X-Timestamp to keep align with Swift API */ dump_header(s, "X-Timestamp", ceph_clock_now()); @@ -188,7 +188,7 @@ void RGWListBuckets_ObjStore_SWIFT::send_response_begin(bool has_buckets) s->user->get_attrs(), s->user->get_info().quota.user_quota, s->user->get_max_buckets(), - static_cast(*s->user_acl)); + *s->user_acl); dump_errno(s); dump_header(s, "Accept-Ranges", "bytes"); end_header(s, NULL, NULL, NO_CONTENT_LENGTH, true); @@ -287,7 +287,7 @@ void RGWListBuckets_ObjStore_SWIFT::send_response_end() s->user->get_attrs(), s->user->get_info().quota.user_quota, s->user->get_max_buckets(), - static_cast(*s->user_acl)); + *s->user_acl); dump_errno(s); end_header(s, nullptr, nullptr, s->formatter->get_len(), true); } @@ -565,7 +565,7 @@ void RGWStatAccount_ObjStore_SWIFT::send_response() attrs, s->user->get_info().quota.user_quota, s->user->get_max_buckets(), - static_cast(*s->user_acl)); + *s->user_acl); } set_req_state_err(s, op_ret); @@ -1057,7 +1057,7 @@ void RGWPutObj_ObjStore_SWIFT::send_response() static int get_swift_account_settings(req_state * const s, rgw::sal::Driver* const driver, - RGWAccessControlPolicy_SWIFTAcct* const policy, + RGWAccessControlPolicy* const policy, bool * const has_policy) { *has_policy = false; @@ -1084,12 +1084,7 @@ int RGWPutMetadataAccount_ObjStore_SWIFT::get_params(optional_yield y) return -EINVAL; } - int ret = get_swift_account_settings(s, - driver, - // FIXME: we need to carry unique_ptr in generic class - // and allocate appropriate ACL class in the ctor - static_cast(&policy), - &has_policy); + int ret = get_swift_account_settings(s, driver, &policy, &has_policy); if (ret < 0) { return ret; } -- 2.39.5