// SPDX-FileCopyrightText: 2024 Yury Gubich // SPDX-License-Identifier: GPL-3.0-or-later #include "module.h" #include #include "gloox/message.h" Module::Module::Module(const std::shared_ptr& core, const Shared::Permissions& permissions, const std::string& name): Shared::Loggable(core->logger, {"Module", name}), core(core), permissions(permissions) {} bool Module::Module::hasPermission(const std::string& permission, const std::shared_ptr<::Actor>& actor) const { Shared::Permissions::const_iterator itr = permissions.find(permission); if (itr == permissions.end()) return false; return std::find(itr->second.begin(), itr->second.end(), actor->getGroup()) != itr->second.end(); } Module::Module::~Module() noexcept {} std::string Module::Module::lower(const std::string& text) { return std::ranges::to(text | std::views::transform(::tolower)); }