]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Get the user metadata of the user used to sign the request 22390/head
authorVolker Theile <vtheile@suse.com>
Tue, 29 May 2018 13:09:02 +0000 (15:09 +0200)
committerVolker Theile <vtheile@suse.com>
Mon, 11 Jun 2018 08:51:14 +0000 (10:51 +0200)
Add REST endpoint /admin/metadata/user?myself to get the metadata of the user that is used to sign the request.

See feature request https://tracker.ceph.com/issues/24335.

Signed-off-by: Volker Theile <vtheile@suse.com>
src/rgw/rgw_rest_metadata.cc
src/rgw/rgw_rest_metadata.h

index 1c588898479c9f0146488553cda8d06bd14a1f61..14056edb38982c83c24116359fb7ba12ea7c5db3 100644 (file)
@@ -59,6 +59,15 @@ void RGWOp_Metadata_Get::execute() {
   http_ret = 0;
 }
 
+void RGWOp_Metadata_Get_Myself::execute() {
+  string owner_id;
+
+  owner_id = s->owner.get_id().to_str();
+  s->info.args.append("key", owner_id);
+
+  return RGWOp_Metadata_Get::execute();
+}
+
 void RGWOp_Metadata_List::execute() {
   string marker = s->info.args.get("marker");
   bool max_entries_specified;
@@ -301,6 +310,8 @@ void RGWOp_Metadata_Unlock::execute() {
 }
 
 RGWOp *RGWHandler_Metadata::op_get() {
+  if (s->info.args.exists("myself"))
+    return new RGWOp_Metadata_Get_Myself;
   if (s->info.args.exists("key"))
     return new RGWOp_Metadata_Get;
   else
index d91cc0015637f1029efe92612affdaff3b08df71..712a7e2d5a1d403e93ed798dc689b6a1111b1907 100644 (file)
@@ -39,6 +39,14 @@ public:
   const char* name() const override { return "get_metadata"; }
 };
 
+class RGWOp_Metadata_Get_Myself : public RGWOp_Metadata_Get {
+public:
+  RGWOp_Metadata_Get_Myself() {}
+  ~RGWOp_Metadata_Get_Myself() override {}
+
+  void execute() override;
+};
+
 class RGWOp_Metadata_Put : public RGWRESTOp {
   int get_data(bufferlist& bl);
   string update_status;