// </magic>
-void MonCapGrant::expand_profile(entity_name_t name) const
+void MonCapGrant::expand_profile(EntityName name) const
{
// only generate this list once
if (!profile_grants.empty())
}
mon_rwxa_t MonCapGrant::get_allowed(CephContext *cct,
- entity_name_t name,
+ EntityName name,
const std::string& s, const std::string& c,
const map<string,string>& c_args) const
{
}
bool MonCap::is_capable(CephContext *cct,
- entity_name_t name,
+ EntityName name,
const string& service,
const string& command, const map<string,string>& command_args,
bool op_may_read, bool op_may_write, bool op_may_exec) const
using std::ostream;
#include "include/types.h"
-#include "msg/msg_types.h"
+#include "common/entity_name.h"
class CephContext;
// needed by expand_profile() (via is_match()) and cached here.
mutable list<MonCapGrant> profile_grants;
- void expand_profile(entity_name_t name) const;
+ void expand_profile(EntityName name) const;
MonCapGrant() : allow(0) {}
MonCapGrant(mon_rwxa_t a) : allow(a) {}
* @return bits we allow
*/
mon_rwxa_t get_allowed(CephContext *cct,
- entity_name_t name,
+ EntityName name,
const std::string& service,
const std::string& command,
const map<string,string>& command_args) const;
* @return true if the operation is allowed, false otherwise
*/
bool is_capable(CephContext *cct,
- entity_name_t name,
+ EntityName name,
const string& service,
const string& command, const map<string,string>& command_args,
bool op_may_read, bool op_may_write, bool op_may_exec) const;
bool cmd_w = this_cmd->requires_perm('w');
bool cmd_x = this_cmd->requires_perm('x');
- bool capable = s->caps.is_capable(g_ceph_context, s->inst.name,
+ bool capable = s->caps.is_capable(g_ceph_context, s->entity_name,
module, prefix, param_str_map,
cmd_r, cmd_w, cmd_x);
bool is_capable(string service, int mask) {
map<string,string> args;
return caps.is_capable(g_ceph_context,
- inst.name,
+ entity_name,
service, "", args,
mask & MON_CAP_R, mask & MON_CAP_W, mask & MON_CAP_X);
}
ASSERT_TRUE(cap.parse("allow *", NULL));
ASSERT_TRUE(cap.is_allow_all());
- ASSERT_TRUE(cap.is_capable(NULL, entity_name_t::CLIENT(0),
+ ASSERT_TRUE(cap.is_capable(NULL, EntityName(),
"foo", "asdf", map<string,string>(), true, true, true));
MonCap cap2;
bool r = cap.parse("allow profile osd", NULL);
ASSERT_TRUE(r);
- entity_name_t name = entity_name_t::OSD(123);
+ EntityName name;
+ name.from_str("osd.123");
map<string,string> ca;
ASSERT_TRUE(cap.is_capable(NULL, name, "osd", "", ca, true, false, false));