]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: minor clean-ups to user policy and config options
authorJ. Eric Ivancich <ivancich@redhat.com>
Sat, 21 Jan 2023 00:19:31 +0000 (19:19 -0500)
committerJ. Eric Ivancich <ivancich@redhat.com>
Tue, 24 Jan 2023 03:21:44 +0000 (22:21 -0500)
Signed-off-by: J. Eric Ivancich <ivancich@redhat.com>
src/common/options/rgw.yaml.in
src/rgw/rgw_rest_user_policy.cc

index 03a9c7a8407a0ed477a0b14e92dc7cd527784846..df784fc279f899ee3231b6e294970ca26e50b7c1 100644 (file)
@@ -3,41 +3,41 @@
 
 options:
 # According to AWS S3(http://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html),
-# An ACL can have up to 100 grants.
+# An ACL may have up to 100 grants.
 - name: rgw_acl_grants_max_num
   type: int
   level: advanced
-  desc: Max number of ACL grants in a single request
+  desc: The maximum number of ACL grants in a single request.
   default: 100
   services:
   - rgw
   with_legacy: true
-# An user can have up to 100 IAM user policies.
+# A user may have up to 100 IAM user policies.
 - name: rgw_user_policies_max_num
   type: int
   level: advanced
-  desc: Max number of IAM user policies on a single user
+  desc: The maximum number of IAM user policies for a single user.
   default: 100
   services:
   - rgw
   with_legacy: true
-# According to AWS S3(http://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html),
-# An cors can have up to 100 rules.
+# According to AWS S3 (http://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html),
+# A CORS request may have up to 100 rules.
 - name: rgw_cors_rules_max_num
   type: int
   level: advanced
-  desc: Max number of cors rules in a single request
+  desc: The maximum number of CORS rules in a single request.
   default: 100
   services:
   - rgw
   with_legacy: true
-# According to AWS S3(https://docs.aws.amazon.com/AmazonS3/latest/dev/DeletingObjects.html),
+# According to AWS S3 (https://docs.aws.amazon.com/AmazonS3/latest/dev/DeletingObjects.html),
 # Amazon S3 also provides the Multi-Object Delete API that you can use to delete up to 1000
 # objects in a single HTTP request.
 - name: rgw_delete_multi_obj_max_num
   type: int
   level: advanced
-  desc: Max number of objects in a single multi-object delete request
+  desc: The maximum number of objects in a single multi-object delete request.
   default: 1000
   services:
   - rgw
@@ -46,7 +46,7 @@ options:
 - name: rgw_website_routing_rules_max_num
   type: int
   level: advanced
-  desc: Max number of website routing rules in a single request
+  desc: The maximum number of website routing rules in a single request.
   default: 50
   services:
   - rgw
@@ -54,21 +54,21 @@ options:
 - name: rgw_rados_tracing
   type: bool
   level: advanced
-  desc: true if LTTng-UST tracepoints should be enabled
+  desc: Enables LTTng-UST tracepoints.
   default: false
   services:
   - rgw
 - name: rgw_op_tracing
   type: bool
   level: advanced
-  desc: true if LTTng-UST tracepoints should be enabled
+  desc: Enables LTTng-UST operator tracepoints.
   default: false
   services:
   - rgw
 - name: rgw_max_chunk_size
   type: size
   level: advanced
-  desc: Set RGW max chunk size
+  desc: The maximum RGW chunk size.
   long_desc: The chunk size is the size of RADOS I/O requests that RGW sends when
     accessing data objects. RGW read and write operations will never request more than
     this amount in a single request. This also defines the RGW head object size, as
@@ -111,7 +111,7 @@ options:
 - name: rgw_max_put_size
   type: size
   level: advanced
-  desc: Max size (in bytes) of regular (non multi-part) object upload.
+  desc: The maximum size (in bytes) of regular (non multi-part) object upload.
   long_desc: Plain object upload is capped at this amount of data. In order to upload
     larger objects, a special upload mechanism is required. The S3 API provides the
     multi-part upload, and Swift provides DLO and SLO.
index 25b1f708d97ac03980e126e46e82a58d8baf7565..2e300468b95cdb3e937e908fd49eface6d7c2287 100644 (file)
@@ -20,8 +20,6 @@
 
 #define dout_subsys ceph_subsys_rgw
 
-using namespace std;
-using rgw::IAM::Policy;
 
 void RGWRestUserPolicy::dump(Formatter *f) const
 {
@@ -50,7 +48,7 @@ int RGWRestUserPolicy::verify_permission(optional_yield y)
   }
 
   uint64_t op = get_op();
-  string user_name = s->info.args.get("UserName");
+  std::string user_name = s->info.args.get("UserName");
   rgw_user user_id(user_name);
   if (! verify_user_permission(this, s, rgw::ARN(rgw::ARN(user_id.id,
                                                 "user",
@@ -141,10 +139,10 @@ void RGWPutUserPolicy::execute(optional_yield y)
   }
 
   try {
-    const Policy p(
+    const rgw::IAM::Policy p(
       s->cct, s->user->get_tenant(), bl,
       s->cct->_conf.get_val<bool>("rgw_policy_reject_invalid_principals"));
-    map<string, string> policies;
+    std::map<std::string, std::string> policies;
     if (auto it = user->get_attrs().find(RGW_ATTR_USER_POLICY); it != user->get_attrs().end()) {
       bufferlist out_bl = it->second;
       decode(policies, out_bl);
@@ -152,7 +150,7 @@ void RGWPutUserPolicy::execute(optional_yield y)
     bufferlist in_bl;
     policies[policy_name] = policy;
     constexpr unsigned int USER_POLICIES_MAX_NUM = 100;
-    const unsigned int max_num = s->cct->_conf->rgw_user_policies_max_num < 0 ? 
+    const unsigned int max_num = s->cct->_conf->rgw_user_policies_max_num < 0 ?
       USER_POLICIES_MAX_NUM : s->cct->_conf->rgw_user_policies_max_num;
     if (policies.size() > max_num) {
       ldpp_dout(this, 4) << "IAM user policies has reached the num config: "
@@ -229,7 +227,7 @@ void RGWGetUserPolicy::execute(optional_yield y)
     s->formatter->dump_string("RequestId", s->trans_id);
     s->formatter->close_section();
     s->formatter->open_object_section("GetUserPolicyResult");
-    map<string, string> policies;
+    std::map<std::string, std::string> policies;
     if (auto it = user->get_attrs().find(RGW_ATTR_USER_POLICY); it != user->get_attrs().end()) {
       bufferlist bl = it->second;
       try {
@@ -293,7 +291,7 @@ void RGWListUserPolicies::execute(optional_yield y)
   }
 
   if (op_ret == 0) {
-    map<string, string> policies;
+    std::map<std::string, std::string> policies;
     if (auto it = user->get_attrs().find(RGW_ATTR_USER_POLICY); it != user->get_attrs().end()) {
       s->formatter->open_object_section("ListUserPoliciesResponse");
       s->formatter->open_object_section("ResponseMetadata");
@@ -376,7 +374,7 @@ void RGWDeleteUserPolicy::execute(optional_yield y)
     ldpp_dout(this, 0) << "ERROR: forward_request_to_master returned ret=" << op_ret << dendl;
   }
 
-  map<string, string> policies;
+  std::map<std::string, std::string> policies;
   if (auto it = user->get_attrs().find(RGW_ATTR_USER_POLICY); it != user->get_attrs().end()) {
     bufferlist out_bl = it->second;
     try {