ostream& operator<<(ostream& out, const OSDCapProfile& m)
{
- out << "profile " << m.name << " ";
+ out << "profile " << m.name;
out << m.pool_namespace;
return out;
}
{
out << "grant(";
if (g.profile.is_valid()) {
- out << g.profile;
+ out << g.profile << " [";
+ for (auto it = g.profile_grants.cbegin();
+ it != g.profile_grants.cend(); ++it) {
+ if (it != g.profile_grants.cbegin()) {
+ out << ",";
+ }
+ out << *it;
+ }
+ out << "]";
} else {
out << g.match << g.spec;
}
bool OSDCapGrant::allow_all() const
{
if (profile.is_valid()) {
- expand_profile();
return std::any_of(profile_grants.cbegin(), profile_grants.cend(),
[](const OSDCapGrant& grant) {
return grant.allow_all();
{
osd_rwxa_t allow = 0;
if (profile.is_valid()) {
- expand_profile();
return std::any_of(profile_grants.cbegin(), profile_grants.cend(),
[&](const OSDCapGrant& grant) {
return grant.is_capable(pool_name, ns, pool_auid, object, op_may_read,
return false;
}
-void OSDCapGrant::expand_profile() const
+void OSDCapGrant::expand_profile()
{
- // only generate this list once
- if (!profile_grants.empty()) {
- return;
- }
-
if (profile.name == "read-only") {
// grants READ-ONLY caps to the OSD
profile_grants.emplace_back(OSDCapMatch(profile.pool_namespace),
// explicit grants that a profile grant expands to; populated as
// needed by expand_profile() and cached here.
- mutable std::list<OSDCapGrant> profile_grants;
+ std::list<OSDCapGrant> profile_grants;
OSDCapGrant() {}
OSDCapGrant(const OSDCapMatch& m, const OSDCapSpec& s) : match(m), spec(s) {}
OSDCapGrant(const OSDCapProfile& profile) : profile(profile) {
+ expand_profile();
}
bool allow_all() const;
const std::vector<OpRequest::ClassInfo>& classes,
std::vector<bool>* class_allowed) const;
- void expand_profile() const;
+ void expand_profile();
};
ostream& operator<<(ostream& out, const OSDCapGrant& g);
op->need_write_cap(),
op->classes());
- dout(20) << "op_has_sufficient_caps pool=" << pool.id << " (" << pool.name
- << " " << req->get_hobj().nspace
+ dout(20) << "op_has_sufficient_caps "
+ << "session=" << session
+ << " pool=" << pool.id << " (" << pool.name
+ << " " << req->get_hobj().nspace
<< ") owner=" << pool.auid
<< " need_read_cap=" << op->need_read_cap()
<< " need_write_cap=" << op->need_write_cap()