add admin from config

This commit is contained in:
Green Sky 2023-12-04 17:17:28 +01:00
parent 51c5d9b06c
commit 632f4d3fe1
No known key found for this signature in database

View File

@ -187,17 +187,23 @@ bool MessageCommandDispatcher::hasPermission(const Command& cmd, const Contact3
return false; // default to false return false; // default to false
} }
if ((cmd.perms & Perms::EVERYONE) != 0) { const auto id_str = bin2hex(_cr.get<Contact::Components::ID>(contact).data);
std::cout << "MCD: perm check for id '" << id_str << "'\n";
// TODO: blacklist here // TODO: blacklist here
// TODO: whitelist here
if ((cmd.perms & Perms::EVERYONE) != 0) {
return true; return true;
} }
// TODO: blacklist here if ((cmd.perms & Perms::ADMIN) != 0) {
auto is_admin_opt = _conf.get_bool("MessageCommandDispatcher", "admin", id_str);
assert(is_admin_opt.has_value);
const auto id_str = bin2hex(_cr.get<Contact::Components::ID>(contact).data); return is_admin_opt.value();
}
//_conf.get_bool // TODO: moderator
//_conf.set("MessageCommandDispatcher", "admin", false);
return false; return false;
} }