]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: don't modify object owner when setting acls
authorYehuda Sadeh <yehuda@hq.newdream.net>
Thu, 14 Apr 2011 21:59:09 +0000 (14:59 -0700)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Thu, 14 Apr 2011 21:59:09 +0000 (14:59 -0700)
src/rgw/rgw_acl.h
src/rgw/rgw_op.cc

index a4bae9357f5a581a3e3fcda5992310b81856b5bc..6ac593f3db36c98426749718c53781341b01bf43 100644 (file)
@@ -373,6 +373,7 @@ public:
   void set_name(string& name) { display_name = name; }
 
   string& get_id() { return id; }
+  string& get_display_name() { return display_name; }
 };
 WRITE_CLASS_ENCODER(ACLOwner)
 
index 5ada240f7e78f210ef764127634a07a0de9cbc46..bc4b201607d3934de982934133120452b815ddaa 100644 (file)
@@ -688,6 +688,7 @@ void RGWPutACLs::execute()
   stringstream ss;
   char *orig_data = data;
   char *new_data = NULL;
+  ACLOwner owner;
 
   if (!verify_permission(s, RGW_PERM_WRITE_ACP)) {
     ret = -EACCES;
@@ -707,6 +708,10 @@ void RGWPutACLs::execute()
        ret = -ENOMEM;
        goto done;
      }
+     owner.set_id(s->user.user_id);
+     owner.set_name(s->user.display_name);
+  } else {
+     owner = s->acl->get_owner();
   }
 
   if (get_params() < 0)
@@ -720,7 +725,7 @@ void RGWPutACLs::execute()
   }
   if (!s->canned_acl.empty()) {
     RGWAccessControlPolicy canned_policy;
-    bool r = canned_policy.create_canned(s->user.user_id, s->user.display_name, s->canned_acl);
+    bool r = canned_policy.create_canned(owner.get_id(), owner.get_display_name(), s->canned_acl);
     if (!r) {
       ret = -EINVAL;
       goto done;
@@ -754,7 +759,7 @@ void RGWPutACLs::execute()
 
   if (rgw_log_level >= 15) {
     RGW_LOG(15) << "New AccessControlPolicy" << endl;
-    new_policy.to_xml(cerr);
+    new_policy.to_xml(cout);
     RGW_LOG(15) << endl;
   }