From ba19b3a03b9db690bd1423ffa3c0d80b8d38a00d Mon Sep 17 00:00:00 2001 From: Pritha Srivastava Date: Thu, 8 Apr 2021 14:34:23 +0530 Subject: rgw/sts: code for aws:TagKeys to be used as Condition element of a role's trust and permission policy. This also includes implementation of ForAnyValue and ForAllValues to be used in conjunction with StringLike, StringEquals and StringEqualsIgnoreCase which are used alongwith aws:TagKeys. Signed-off-by: Pritha Srivastava --- src/rgw/rgw_iam_policy.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/rgw/rgw_iam_policy.h') diff --git a/src/rgw/rgw_iam_policy.h b/src/rgw/rgw_iam_policy.h index 84dce04cf24..4a0f8f3b30f 100644 --- a/src/rgw/rgw_iam_policy.h +++ b/src/rgw/rgw_iam_policy.h @@ -391,6 +391,23 @@ struct Condition { }; using unordered_multimap_it_pair = std::pair ::const_iterator, std::unordered_multimap::const_iterator>; + + template + static bool andible(F&& f, const unordered_multimap_it_pair& it, + const std::vector& v) { + for (auto itr = it.first; itr != it.second; itr++) { + bool matched = false; + for (const auto& d : v) { + if (std::forward(f)(itr->second, d)) { + matched = true; + } + } + if (!matched) + return false; + } + return true; + } + template static bool orrible(F&& f, const unordered_multimap_it_pair& it, const std::vector& v) { -- cgit v1.2.3