1
0
mirror of https://github.com/anope/anope.git synced 2026-07-07 18:23:14 +02:00

Allow channels on access lists

This commit is contained in:
Adam
2013-07-03 22:45:00 -04:00
parent c2e1a8a3e2
commit 7f971043bc
11 changed files with 294 additions and 86 deletions
+12 -2
View File
@@ -75,6 +75,13 @@ class CoreExport AccessProvider : public Service
class CoreExport ChanAccess : public Serializable
{
public:
typedef std::multimap<const ChanAccess *, const ChanAccess *> Set;
/* shows the 'path' taken to determine if an access entry matches a user
* .first are access entries checked
* .second are access entries which match
*/
typedef std::pair<Set, Set> Path;
/* The provider that created this access entry */
AccessProvider *provider;
/* Channel this access entry is on */
@@ -95,8 +102,9 @@ class CoreExport ChanAccess : public Serializable
/** Check if this access entry matches the given user or account
* @param u The user
* @param nc The account
* @param p The path to the access object which matches will be put here
*/
virtual bool Matches(const User *u, const NickCore *nc) const;
virtual bool Matches(const User *u, const NickCore *nc, Path &p) const;
/** Check if this access entry has the given privilege.
* @param name The privilege name
@@ -127,8 +135,10 @@ class CoreExport ChanAccess : public Serializable
class CoreExport AccessGroup : public std::vector<ChanAccess *>
{
public:
/* Channel these access entries are on */
/* Channel these access entries are on */
const ChannelInfo *ci;
/* Path from these entries to other entries that they depend on */
ChanAccess::Path path;
/* Account these entries affect, if any */
const NickCore *nc;
/* super_admin always gets all privs. founder is a special case where ci->founder == nc */
+3 -3
View File
@@ -597,10 +597,10 @@ class CoreExport Module : public Extensible
*/
virtual void OnBotDelete(BotInfo *bi) { throw NotImplementedException(); }
/** Called when access is deleted from a channel
/** Called after an access entry is deleted from a channel
* @param ci The channel
* @param source The source of the command
* @param access The access entry being removed
* @param access The access entry that was removed
*/
virtual void OnAccessDel(ChannelInfo *ci, CommandSource &source, ChanAccess *access) { throw NotImplementedException(); }
@@ -704,7 +704,7 @@ class CoreExport Module : public Extensible
* @param priv The privilege being checked for
* @return EVENT_ALLOW for yes, EVENT_STOP to stop all processing
*/
virtual EventReturn OnCheckPriv(ChanAccess *access, const Anope::string &priv) { throw NotImplementedException(); }
virtual EventReturn OnCheckPriv(const ChanAccess *access, const Anope::string &priv) { throw NotImplementedException(); }
/** Check whether an access group has a privilege
* @param group The group
+7 -2
View File
@@ -137,13 +137,18 @@ class CoreExport ChannelInfo : public Serializable, public Extensible
*/
unsigned GetAccessCount() const;
/** Get the number of access entries for this channel,
* including those that are on other channels.
*/
unsigned GetDeepAccessCount() const;
/** Erase an entry from the channel access list
*
* @param index The index in the access list vector
*
* Clears the memory used by the given access entry and removes it from the vector.
* @return The erased entry
*/
void EraseAccess(unsigned index);
ChanAccess *EraseAccess(unsigned index);
/** Clear the entire channel access list
*