]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: adminops API now supports tenant param for user creation 16442/head
authorAbhishek Lekshmanan <abhishek@suse.com>
Thu, 20 Jul 2017 09:08:30 +0000 (11:08 +0200)
committerAbhishek Lekshmanan <abhishek@suse.com>
Mon, 24 Jul 2017 15:43:51 +0000 (17:43 +0200)
Allow `tenant` as a param for user creation API, also document this.
Currently we still return a -ENOENT when an invalid tenant name is
specified, while we could make it return -ERR_INVALID_TENANT, this would
make rgw admin cli not return -ENOENT when an invalid tenant name is
specified.

Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
doc/radosgw/adminops.rst
src/rgw/rgw_rest_user.cc

index 597f4fe5d26f0941b3e57768a074a2debc4844af..422dd16527a446264c2cbbad123d792b4b2d9f6e 100644 (file)
@@ -321,6 +321,11 @@ generated key is added to the keyring without replacing an existing key pair.
 If ``access-key`` is specified and refers to an existing key owned by the user
 then it will be modified.
 
+.. versionadded:: Luminous
+
+A ``tenant`` may either be specified as a part of uid or as an additional
+request param.
+
 :caps: users=write
 
 Syntax
@@ -409,6 +414,14 @@ A tenant name may also specified as a part of ``uid``, by following the syntax `
 :Example: False [False]
 :Required: No
 
+.. versionadded:: Jewel
+``tenant``
+
+:Description: the Tenant under which a user is a part of.
+:Type: string
+:Example: tenant1
+:Required: No
+
 Response Entities
 ~~~~~~~~~~~~~~~~~
 
index 711fd3a0c1dca6c0d593d2b73ec1e1e437a30844..8539c3ed766409a923b70e836b88a1429e68d0b8 100644 (file)
@@ -76,6 +76,7 @@ void RGWOp_User_Create::execute()
   std::string secret_key;
   std::string key_type_str;
   std::string caps;
+  std::string tenant_name;
 
   bool gen_key;
   bool suspended;
@@ -96,6 +97,7 @@ void RGWOp_User_Create::execute()
   RESTArgs::get_string(s, "secret-key", secret_key, &secret_key);
   RESTArgs::get_string(s, "key-type", key_type_str, &key_type_str);
   RESTArgs::get_string(s, "user-caps", caps, &caps);
+  RESTArgs::get_string(s, "tenant", tenant_name, &tenant_name);
   RESTArgs::get_bool(s, "generate-key", true, &gen_key);
   RESTArgs::get_bool(s, "suspended", false, &suspended);
   RESTArgs::get_int32(s, "max-buckets", default_max_buckets, &max_buckets);
@@ -108,6 +110,10 @@ void RGWOp_User_Create::execute()
     return;
   }
 
+  if (!tenant_name.empty()) {
+    uid.tenant = tenant_name;
+  }
+
   // TODO: validate required args are passed in. (for eg. uid and display_name here)
   op_state.set_user_id(uid);
   op_state.set_display_name(display_name);