summaryrefslogtreecommitdiff
path: root/include/access.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/access.h')
-rw-r--r--include/access.h21
1 files changed, 10 insertions, 11 deletions
diff --git a/include/access.h b/include/access.h
index c77d9aa29..6f0124928 100644
--- a/include/access.h
+++ b/include/access.h
@@ -78,12 +78,7 @@ class CoreExport ChanAccess : public Serializable
Serialize::Reference<NickCore> nc;
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;
+ typedef std::vector<ChanAccess *> Path;
/* The provider that created this access entry */
AccessProvider *provider;
@@ -103,12 +98,14 @@ class CoreExport ChanAccess : public Serializable
void Serialize(Serialize::Data &data) const anope_override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
+ static const unsigned int MAX_DEPTH = 4;
+
/** 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
+ * @param next Next channel to check if any
*/
- virtual bool Matches(const User *u, const NickCore *nc, Path &p) const;
+ virtual bool Matches(const User *u, const NickCore *nc, ChannelInfo* &next) const;
/** Check if this access entry has the given privilege.
* @param name The privilege name
@@ -136,13 +133,13 @@ class CoreExport ChanAccess : public Serializable
/* A group of access entries. This is used commonly, for example with ChannelInfo::AccessFor,
* to show what access a user has on a channel because users can match multiple access entries.
*/
-class CoreExport AccessGroup : public std::vector<ChanAccess *>
+class CoreExport AccessGroup
{
public:
+ /* access entries + paths */
+ std::vector<ChanAccess::Path> paths;
/* 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 */
@@ -170,6 +167,8 @@ class CoreExport AccessGroup : public std::vector<ChanAccess *>
bool operator<(const AccessGroup &other) const;
bool operator>=(const AccessGroup &other) const;
bool operator<=(const AccessGroup &other) const;
+
+ inline bool empty() const { return paths.empty(); }
};
#endif