]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/acl/swift: remove RGWAccessControlPolicy subclasses
authorCasey Bodley <cbodley@redhat.com>
Thu, 16 Nov 2023 19:05:36 +0000 (14:05 -0500)
committerCasey Bodley <cbodley@redhat.com>
Thu, 30 Nov 2023 15:58:48 +0000 (10:58 -0500)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_acl_swift.h
src/rgw/rgw_op.cc
src/rgw/rgw_rest_swift.cc

index 9eeb9cb6caeafdfbca8972ab42e88ffa7f19f946..a16bea894dbe56c54b748257e8f4374ea4e37494 100644 (file)
@@ -3,15 +3,12 @@
 
 #pragma once
 
-#include <map>
-#include <vector>
 #include <string>
-#include <include/types.h>
+#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<std::string>;
 
 } // namespace rgw::swift
-
-class RGWAccessControlPolicy_SWIFT : public RGWAccessControlPolicy
-{
-};
-
-class RGWAccessControlPolicy_SWIFTAcct : public RGWAccessControlPolicy
-{
-};
index 593d1598aefaa7364b191971c92f56fed0cd9201..cbc13d593f122ee407faf88761fe3382e4af5b64 100644 (file)
@@ -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<RGWAccessControlPolicy_SWIFTAcct>();
+      s->user_acl = std::make_unique<RGWAccessControlPolicy>();
     }
-    s->bucket_acl = std::make_unique<RGWAccessControlPolicy_SWIFT>();
+    s->bucket_acl = std::make_unique<RGWAccessControlPolicy>();
   } else {
     s->bucket_acl = std::make_unique<RGWAccessControlPolicy>();
   }
index a752e827b12c2e4ed55d6acbde7bb3f3a06ce518..55ebac5137c83b97b86c104e7365af0cfa21502d 100644 (file)
@@ -92,7 +92,7 @@ static void dump_account_metadata(req_state * const s,
                                   /* const */map<string, bufferlist>& attrs,
                                   const RGWQuotaInfo& quota,
                                   int32_t max_buckets,
-                                  const RGWAccessControlPolicy_SWIFTAcct &policy)
+                                  const RGWAccessControlPolicypolicy)
 {
   /* 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<RGWAccessControlPolicy_SWIFTAcct&>(*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<RGWAccessControlPolicy_SWIFTAcct&>(*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<RGWAccessControlPolicy_SWIFTAcct&>(*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<RGWAccessControlPolicy_SWIFTAcct *>(&policy),
-                                       &has_policy);
+  int ret = get_swift_account_settings(s, driver, &policy, &has_policy);
   if (ret < 0) {
     return ret;
   }