return perm_mask;
}
- std::string to_str() const {
- std::stringstream ss;
-
- ss << "RGWDummyIdentityApplier(auth_id=" << id
- << ", perm_mask=" << perm_mask
- << ", is_admin=" << is_admin << ")";
-
- return ss.str();
+ void to_str(std::ostream& out) const {
+ out << "RGWDummyIdentityApplier(auth_id=" << id
+ << ", perm_mask=" << perm_mask
+ << ", is_admin=" << is_admin << ")";
}
};
return info.acct_user == uid;
}
-std::string RGWRemoteAuthApplier::to_str() const
+void RGWRemoteAuthApplier::to_str(std::ostream& out) const
{
- std::stringstream ss;
-
- ss << "RGWRemoteAuthApplier(acct_user=" << info.acct_user
- << ", acct_name=" << info.acct_name
- << ", perm_mask=" << info.perm_mask
- << ", is_admin=" << info.is_admin << ")";
-
- return ss.str();
+ out << "RGWRemoteAuthApplier(acct_user=" << info.acct_user
+ << ", acct_name=" << info.acct_name
+ << ", perm_mask=" << info.perm_mask
+ << ", is_admin=" << info.is_admin << ")";
}
void RGWRemoteAuthApplier::create_account(const rgw_user& acct_user,
return uid == user_info.user_id;
}
-std::string RGWLocalAuthApplier::to_str() const
+void RGWLocalAuthApplier::to_str(std::ostream& out) const
{
- std::stringstream ss;
-
- ss << "RGWLocalAuthApplier(acct_user=" << user_info.user_id
- << ", acct_name=" << user_info.display_name
- << ", subuser=" << subuser
- << ", perm_mask=" << get_perm_mask()
- << ", is_admin=" << user_info.admin << ")";
-
- return ss.str();
+ out << "RGWLocalAuthApplier(acct_user=" << user_info.user_id
+ << ", acct_name=" << user_info.display_name
+ << ", subuser=" << subuser
+ << ", perm_mask=" << get_perm_mask()
+ << ", is_admin=" << user_info.admin << ")";
}
uint32_t RGWLocalAuthApplier::get_perm_mask(const std::string& subuser_name,
#define CEPH_RGW_AUTH_H
#include <functional>
+#include <ostream>
#include <type_traits>
#include "rgw_common.h"
return is_owner_of(rgw_user(RGW_USER_ANON_ID));
}
- virtual std::string to_str() const = 0;
+ virtual void to_str(std::ostream& out) const = 0;
};
inline std::ostream& operator<<(std::ostream& out,
const RGWIdentityApplier &id) {
- return out << id.to_str();
+ id.to_str(out);
+ return out;
}
std::unique_ptr<RGWIdentityApplier>
bool is_admin_of(const rgw_user& uid) const override;
bool is_owner_of(const rgw_user& uid) const override;
uint32_t get_perm_mask() const override { return info.perm_mask; }
- std::string to_str() const override;
+ void to_str(std::ostream& out) const override;
void load_acct_info(RGWUserInfo& user_info) const override; /* out */
struct Factory {
uint32_t get_perm_mask() const override {
return get_perm_mask(subuser, user_info);
}
- std::string to_str() const override;
+ void to_str(std::ostream& out) const override;
void load_acct_info(RGWUserInfo& user_info) const override; /* out */
struct Factory {
return decoratee.get_perm_mask();
}
- virtual std::string to_str() const override {
- return decoratee.to_str();
+ virtual void to_str(std::ostream& out) const override {
+ decoratee.to_str(out);
}
virtual void load_acct_info(RGWUserInfo& user_info) const override { /* out */
return decoratee->get_perm_mask();
}
- virtual std::string to_str() const override {
- return decoratee->to_str();
+ virtual void to_str(std::ostream& out) const override {
+ decoratee->to_str(out);
}
virtual void load_acct_info(RGWUserInfo& user_info) const override { /* out */
acct_user_override(acct_user_override) {
}
- virtual std::string to_str() const override;
+ virtual void to_str(std::ostream& out) const override;
virtual void load_acct_info(RGWUserInfo& user_info) const override; /* out */
};
const rgw_user RGWThirdPartyAccountAuthApplier<T>::UNKNOWN_ACCT;
template <typename T>
-std::string RGWThirdPartyAccountAuthApplier<T>::to_str() const
+void RGWThirdPartyAccountAuthApplier<T>::to_str(std::ostream& out) const
{
- return "RGWThirdPartyAccountAuthApplier(" + acct_user_override.to_str() + ")"
- " -> " + RGWDecoratingAuthApplier<T>::to_str();
+ out << "RGWThirdPartyAccountAuthApplier(" + acct_user_override.to_str() + ")"
+ << " -> ";
+ RGWDecoratingAuthApplier<T>::to_str(out);
}
template <typename T>