]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: split rgw_iam_eval_existing_objtags to seperate functions
authorAbhishek Lekshmanan <abhishek@suse.com>
Wed, 16 Aug 2017 12:19:53 +0000 (14:19 +0200)
committerAbhishek Lekshmanan <abhishek@suse.com>
Wed, 17 Jan 2018 10:28:56 +0000 (11:28 +0100)
one for adding tags to env and the other which calls eval, useful for
Ops where we dont need an eval but need it in the env

Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
src/rgw/rgw_op.cc

index 6f4421d7e9e03749a05e404c3ab04afee1750b1d..c84bf73e6f196824e4c9f50d45305a64f4c0ad91 100644 (file)
@@ -568,7 +568,7 @@ void rgw_add_to_iam_environment(rgw::IAM::Environment& e, const std::string& key
            std::forward_as_tuple(val));
 }
 
-static int rgw_iam_eval_existing_objtags(RGWRados* store, struct req_state* s, rgw_obj& obj, std::uint64_t action){
+static int rgw_iam_add_existing_objtags(RGWRados* store, struct req_state* s, rgw_obj& obj, std::uint64_t action){
   map <string, bufferlist> attrs;
   store->set_atomic(s->obj_ctx, obj);
   int op_ret = get_obj_attrs(store, s, obj, attrs);
@@ -591,11 +591,19 @@ static int rgw_iam_eval_existing_objtags(RGWRados* store, struct req_state* s, r
     }
   }
 
+  return 0;
+}
+
+static int rgw_iam_eval_existing_objtags(RGWRados* store, struct req_state* s, rgw_obj& obj, std::uint64_t action){
+  int op_ret = rgw_iam_add_existing_objtags(store, s, obj, action);
+  if (op_ret < 0)
+    return op_ret;
   auto e = s->iam_policy->eval(s->env, *s->auth.identity, action, obj);
   if (e == Effect::Deny)
     return -EACCES;
 
   return 0;
+
 }
 
 rgw::IAM::Environment rgw_build_iam_environment(RGWRados* store,