diff options
author | Adam <Adam@anope.org> | 2013-11-01 04:58:38 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-11-01 04:58:38 -0400 |
commit | 4ee9021adbb10140c30d6027a97e4748cb2f5903 (patch) | |
tree | f587e7492f142f8d4e7a908190c83a22087559b0 /src | |
parent | c8db362bca238aaedf9113383a731d18ba88594f (diff) |
Compare access entries created with the levels access system by access level and not by privilege set, as two entries can have the same privset but different levels, but still represent two different levels of access. This prevented users from adding other users at a lower access level when that level had the same privset as them. Spotted by TSG.
Diffstat (limited to 'src')
-rw-r--r-- | src/access.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/access.cpp b/src/access.cpp index 2533f4415..f4b97c21e 100644 --- a/src/access.cpp +++ b/src/access.cpp @@ -363,12 +363,11 @@ bool AccessGroup::HasPriv(const Anope::string &name) const const ChanAccess *AccessGroup::Highest() const { - const std::vector<Privilege> &privs = PrivilegeManager::GetPrivileges(); - for (unsigned i = privs.size(); i > 0; --i) - for (unsigned j = this->size(); j > 0; --j) - if (this->at(j - 1)->HasPriv(privs[i - 1].name)) - return this->at(j - 1); - return NULL; + ChanAccess *highest = NULL; + for (unsigned i = 0; i < this->size(); ++i) + if (highest == NULL || *this->at(i) > *highest) + highest = this->at(i); + return highest; } bool AccessGroup::operator>(const AccessGroup &other) const |