// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab ft=cpp
+#include <algorithm>
#include <errno.h>
+#include <iterator>
#include <regex>
#include "common/errno.h"
return -EINVAL;
}
- auto val_map = s->info.args.get_params();
- for (auto& it : val_map) {
- if (it.first.find("TagKeys.member.") != string::npos) {
- tagKeys.emplace_back(it.second);
- }
+ const auto& params = s->info.args.get_params();
+ const std::string prefix = "TagKeys.member.";
+ if (auto l = params.lower_bound(prefix); l != params.end()) {
+ // copy matching values into untag vector
+ std::transform(l, params.upper_bound(prefix), std::back_inserter(untag),
+ [] (const std::pair<const std::string, std::string>& p) {
+ return p.second;
+ });
}
return 0;
}
s->info.args.remove("RoleName");
s->info.args.remove("Action");
s->info.args.remove("Version");
- auto& val_map = s->info.args.get_params();
- std::vector<std::multimap<std::string, std::string>::iterator> iters;
- for (auto it = val_map.begin(); it!= val_map.end(); it++) {
- if (it->first.find("Tags.member.") == 0) {
- iters.emplace_back(it);
- }
+ auto& params = s->info.args.get_params();
+ if (auto l = params.lower_bound("TagKeys.member."); l != params.end()) {
+ params.erase(l, params.upper_bound("TagKeys.member."));
}
- for (auto& it : iters) {
- val_map.erase(it);
- }
op_ret = forward_iam_request_to_master(this, site, s->user->get_info(),
bl_post_body, parser, s->info, y);
if (op_ret < 0) {
}
}
- _role->erase_tags(tagKeys);
+ _role->erase_tags(untag);
op_ret = _role->update(this, y);
if (op_ret == 0) {
std::string path_prefix;
std::string max_session_duration;
std::multimap<std::string,std::string> tags;
- std::vector<std::string> tagKeys;
std::unique_ptr<rgw::sal::RGWRole> _role;
int verify_permission(optional_yield y) override;
int init_processing(optional_yield y) override;
class RGWUntagRole : public RGWRoleWrite {
bufferlist bl_post_body;
+ std::vector<std::string> untag;
public:
RGWUntagRole(const bufferlist& bl_post_body) : bl_post_body(bl_post_body) {};
void execute(optional_yield y) override;