diff options
author | Adam <Adam@anope.org> | 2011-03-14 13:52:26 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2011-03-14 13:52:26 -0400 |
commit | ed73d7675152ccc66f20daedca8586a8de254a84 (patch) | |
tree | 18f7a1a53a717f24d061550c6670ca6f0ed54f9f /src/users.cpp | |
parent | 4fe49af8401b956249d924b89b3e69bce5fb6744 (diff) |
Rewrote some of the opertype system, added os_login
Diffstat (limited to 'src/users.cpp')
-rw-r--r-- | src/users.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/users.cpp b/src/users.cpp index 4b6e7368e..5e97fee5d 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -462,6 +462,46 @@ bool User::IsRecognized(bool CheckSecure) return OnAccess; } +/** Check if the user is a services oper + * @return true if they are an oper + */ +bool User::IsServicesOper() +{ + if (!this->nc || !this->nc->o) + // No opertype. + return false; + else if (!this->nc->o->certfp.empty() && this->fingerprint != this->nc->o->certfp) + // Certfp mismatch + return false; + else if (!this->nc->o->password.empty() && !this->GetExt("os_login_password_correct")) + // Not identified + return false; + + return true; +} + +/** Check whether this user has access to run the given command string. + * @param cmdstr The string to check, e.g. botserv/set/private. + * @return True if this user may run the specified command, false otherwise. + */ +bool User::HasCommand(const Anope::string &command) +{ + if (this->IsServicesOper()) + return this->nc->o->ot->HasCommand(command); + return false; +} + +/** Check whether this user has access to the given special permission. + * @param privstr The priv to check for, e.g. users/auspex. + * @return True if this user has the specified priv, false otherwise. + */ +bool User::HasPriv(const Anope::string &priv) +{ + if (this->IsServicesOper()) + return this->nc->o->ot->HasPriv(priv); + return false; +} + /** Update the last usermask stored for a user, and check to see if they are recognized */ void User::UpdateHost() |