From: Abhishek Lekshmanan Date: Wed, 16 Aug 2017 12:19:53 +0000 (+0200) Subject: rgw: split rgw_iam_eval_existing_objtags to seperate functions X-Git-Tag: v13.0.2~246^2~23 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=00113eb0dca0f9436d38471024ca4d06cfbb26e3;p=ceph.git rgw: split rgw_iam_eval_existing_objtags to seperate functions 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 --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 6f4421d7e9e0..c84bf73e6f19 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -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 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,