mirror of
https://github.com/anope/anope.git
synced 2026-07-04 01:03:12 +02:00
Bug #1368 - check all members of a users gruop against the access list
This commit is contained in:
+1
-1
@@ -55,7 +55,7 @@ class CoreExport ChanAccess : public Serializable
|
||||
serialized_data serialize();
|
||||
static void unserialize(serialized_data &);
|
||||
|
||||
virtual bool Matches(User *u, NickCore *nc) = 0;
|
||||
virtual bool Matches(User *u, NickCore *nc);
|
||||
virtual bool HasPriv(const Anope::string &name) const = 0;
|
||||
virtual Anope::string Serialize() = 0;
|
||||
virtual void Unserialize(const Anope::string &data) = 0;
|
||||
|
||||
@@ -31,15 +31,6 @@ class AccessChanAccess : public ChanAccess
|
||||
{
|
||||
}
|
||||
|
||||
bool Matches(User *u, NickCore *nc)
|
||||
{
|
||||
if (u && this->mask.find_first_of("!@?*") != Anope::string::npos && (Anope::Match(u->nick, this->mask) || Anope::Match(u->GetMask(), this->mask)))
|
||||
return true;
|
||||
else if (nc && Anope::Match(nc->display, this->mask))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool HasPriv(const Anope::string &name) const
|
||||
{
|
||||
return this->ci->GetLevel(name) != ACCESS_INVALID && this->level >= this->ci->GetLevel(name);
|
||||
|
||||
@@ -24,15 +24,6 @@ class FlagsChanAccess : public ChanAccess
|
||||
{
|
||||
}
|
||||
|
||||
bool Matches(User *u, NickCore *nc)
|
||||
{
|
||||
if (u && this->mask.find_first_of("!@?*") != Anope::string::npos && (Anope::Match(u->nick, this->mask) || Anope::Match(u->GetMask(), this->mask)))
|
||||
return true;
|
||||
else if (nc && Anope::Match(nc->display, this->mask))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool HasPriv(const Anope::string &priv) const
|
||||
{
|
||||
std::map<Anope::string, char>::iterator it = defaultFlags.find(priv);
|
||||
|
||||
@@ -99,15 +99,6 @@ class XOPChanAccess : public ChanAccess
|
||||
{
|
||||
}
|
||||
|
||||
bool Matches(User *u, NickCore *nc)
|
||||
{
|
||||
if (u && this->mask.find_first_of("!@?*") != Anope::string::npos && (Anope::Match(u->nick, this->mask) || Anope::Match(u->GetMask(), this->mask)))
|
||||
return true;
|
||||
else if (nc && Anope::Match(nc->display, this->mask))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool HasPriv(const Anope::string &priv) const
|
||||
{
|
||||
for (int i = 0; xopAccess[i].type != XOP_UNKNOWN; ++i)
|
||||
|
||||
@@ -70,7 +70,8 @@ class CommandNSAList : public Command
|
||||
entry["Channel"] = (ci->HasFlag(CI_NO_EXPIRE) ? "!" : "") + ci->name;
|
||||
for (unsigned i = 0; i < access.size(); ++i)
|
||||
entry["Access"] = entry["Access"] + ", " + access[i]->Serialize();
|
||||
entry["Access"] = entry["Access"].substr(3);
|
||||
entry["Access"] = entry["Access"].substr(2);
|
||||
list.addEntry(entry);
|
||||
}
|
||||
|
||||
std::vector<Anope::string> replies;
|
||||
|
||||
@@ -120,6 +120,22 @@ void ChanAccess::unserialize(serialized_data &data)
|
||||
ci->AddAccess(access);
|
||||
}
|
||||
|
||||
bool ChanAccess::Matches(User *u, NickCore *nc)
|
||||
{
|
||||
if (u && Anope::Match(u->nick, this->mask))
|
||||
return true;
|
||||
else if (u && Anope::Match(u->GetDisplayedMask(), this->mask))
|
||||
return true;
|
||||
else if (nc)
|
||||
for (std::list<NickAlias *>::iterator it = nc->aliases.begin(); it != nc->aliases.end(); ++it)
|
||||
{
|
||||
NickAlias *na = *it;
|
||||
if (Anope::Match(na->nick, this->mask))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ChanAccess::operator>(const ChanAccess &other) const
|
||||
{
|
||||
const std::vector<Privilege> &privs = PrivilegeManager::GetPrivileges();
|
||||
|
||||
Reference in New Issue
Block a user