diff options
Diffstat (limited to 'include/access.h')
-rw-r--r-- | include/access.h | 59 |
1 files changed, 19 insertions, 40 deletions
diff --git a/include/access.h b/include/access.h index 0c730c9ff..6557d40c6 100644 --- a/include/access.h +++ b/include/access.h @@ -1,45 +1,24 @@ #ifndef ACCESS_H #define ACCESS_H -enum ChannelAccess +struct Privilege { - CA_ACCESS_LIST, - CA_NOKICK, - CA_FANTASIA, - CA_GREET, - CA_AUTOVOICE, - CA_VOICEME, - CA_VOICE, - CA_INFO, - CA_SAY, - CA_AUTOHALFOP, - CA_HALFOPME, - CA_HALFOP, - CA_KICK, - CA_SIGNKICK, - CA_BAN, - CA_TOPIC, - CA_MODE, - CA_GETKEY, - CA_INVITE, - CA_UNBAN, - CA_AUTOOP, - CA_OPDEOPME, - CA_OPDEOP, - CA_AUTOPROTECT, - CA_AKICK, - CA_BADWORDS, - CA_ASSIGN, - CA_MEMO, - CA_ACCESS_CHANGE, - CA_PROTECTME, - CA_PROTECT, - CA_SET, - CA_AUTOOWNER, - CA_OWNERME, - CA_OWNER, - CA_FOUNDER, - CA_SIZE + Anope::string name; + Anope::string desc; + + Privilege(const Anope::string &n, const Anope::string &d); + bool operator==(const Privilege &other); +}; + +class PrivilegeManager +{ + static std::vector<Privilege> privs; + public: + static void AddPrivilege(Privilege p, int pos = -1, int def = 0); + static void RemovePrivilege(Privilege &p); + static Privilege *FindPrivilege(const Anope::string &name); + static void Init(); + static std::vector<Privilege> &GetPrivileges(); }; class ChanAccess; @@ -65,7 +44,7 @@ class CoreExport ChanAccess ChanAccess(AccessProvider *p); virtual ~ChanAccess(); virtual bool Matches(User *u, NickCore *nc) = 0; - virtual bool HasPriv(ChannelAccess priv) = 0; + virtual bool HasPriv(const Anope::string &name) = 0; virtual Anope::string Serialize() = 0; virtual void Unserialize(const Anope::string &data) = 0; @@ -82,7 +61,7 @@ class CoreExport AccessGroup : public std::vector<ChanAccess *> NickCore *nc; bool SuperAdmin, Founder; AccessGroup(); - bool HasPriv(ChannelAccess priv) const; + bool HasPriv(const Anope::string &priv) const; ChanAccess *Highest() const; bool operator>(const AccessGroup &other) const; bool operator<(const AccessGroup &other) const; |