diff options
| author | 2022-11-27 07:32:42 +0000 | |
|---|---|---|
| committer | 2022-11-28 02:57:50 +0000 | |
| commit | ee44af8d04f23b4a16c9b377764f930d69e575f7 (patch) | |
| tree | 4348a9d4b76ea65266875651d57d2ebf3e1d7894 /src/modules/m_ldapoper.cpp | |
| parent | Merge branch 'insp3' into master. (diff) | |
Refactor the internals of the oper system.
- Allow overriding privileges from the <class> blocks in the <type>
and <oper> blocks.
- Separate oper types from oper accounts in the code. This enables
moving some core stuff out of the config tag later.
- Merge the config tags together to make a synthetic tag that can
have getXXX called on it instead of using getConfig and then
converting it.
- Move the details of Have*Permission into the oper type class.
- Improve oper events to allow modules to easily hook into the oper
system.
Diffstat (limited to 'src/modules/m_ldapoper.cpp')
| -rw-r--r-- | src/modules/m_ldapoper.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/modules/m_ldapoper.cpp b/src/modules/m_ldapoper.cpp index 78a235919..57e570d31 100644 --- a/src/modules/m_ldapoper.cpp +++ b/src/modules/m_ldapoper.cpp @@ -85,16 +85,16 @@ public: void OnResult(const LDAPResult& r) override { auto user = ServerInstance->Users.FindUUID(uid); - ServerConfig::OperIndex::const_iterator iter = ServerInstance->Config->oper_blocks.find(opername); + auto iter = ServerInstance->Config->OperAccounts.find(opername); - if (!user || iter == ServerInstance->Config->oper_blocks.end()) + if (!user || iter == ServerInstance->Config->OperAccounts.end()) { Fallback(); delete this; return; } - user->Oper(iter->second); + user->OperLogin(iter->second); delete this; } }; @@ -219,15 +219,11 @@ public: const std::string& opername = parameters[0]; const std::string& password = parameters[1]; - ServerConfig::OperIndex::const_iterator it = ServerInstance->Config->oper_blocks.find(opername); - if (it == ServerInstance->Config->oper_blocks.end()) + auto it = ServerInstance->Config->OperAccounts.find(opername); + if (it == ServerInstance->Config->OperAccounts.end()) return MOD_RES_PASSTHRU; - std::shared_ptr<ConfigTag> tag = it->second->oper_block; - if (!tag) - return MOD_RES_PASSTHRU; - - std::string acceptedhosts = tag->getString("host"); + std::string acceptedhosts = it->second->GetConfig()->getString("host"); if (!InspIRCd::MatchMask(acceptedhosts, user->MakeHost(), user->MakeHostIP())) return MOD_RES_PASSTHRU; |
