class RGWSI_Role_Module : public RGWSI_MBSObj_Handler_Module {
RGWSI_Role_RADOS::Svc& svc;
+ const std::string prefix;
public:
- RGWSI_Role_Module(RGWSI_Role_RADOS::Svc& _svc): RGWSI_MBSObj_Handler_Module("Role"),
- svc(_svc) {}
+ RGWSI_Role_Module(RGWSI_Role_RADOS::Svc& _svc): RGWSI_MBSObj_Handler_Module("roles"),
+ svc(_svc),
+ prefix(role_oid_prefix) {}
void get_pool_and_oid(const std::string& key,
rgw_pool *pool,
}
if (oid) {
- *oid = key;
+ *oid = key_to_oid(key);
}
}
bool is_valid_oid(const std::string& oid) override {
- return boost::algorithm::starts_with(oid, role_oid_prefix);
+ return boost::algorithm::starts_with(oid, prefix);
}
std::string key_to_oid(const std::string& key) override {
- return key;
+ return prefix + key;
}
+ // This is called after `is_valid_oid` and is assumed to be a valid oid
std::string oid_to_key(const std::string& oid) override {
- return oid;
+ return oid.substr(prefix.size());
}
const std::string& get_oid_prefix() {
- return role_oid_prefix;
+ return prefix;
}
};