]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/authorization/ao/ao.h
Start replacing notifiers with subscriptions.
[stg.git] / projects / stargazer / plugins / authorization / ao / ao.h
index dbb2993a7c611eeb65d04ddafaa19e318e228c43..18b4142971d2ef6635e2609a8915649248d9a748 100644 (file)
@@ -24,6 +24,7 @@
 #include "stg/module_settings.h"
 #include "stg/store.h"
 #include "stg/notifer.h"
+#include "stg/subscriptions.h"
 #include "stg/user_ips.h"
 #include "stg/user.h"
 #include "stg/logger.h"
@@ -51,7 +52,7 @@ public:
                     : user(u), auth(a) {}
                 CHG_BEFORE_NOTIFIER(const CHG_BEFORE_NOTIFIER<T> & rvalue)
                     : user(rvalue.user), auth(rvalue.auth) {}
-    void        Notify(const T & oldValue, const T & newValue);
+    void        notify(const T & oldValue, const T & newValue) override;
     UserPtr    GetUser() const { return user; }
 
 private:
@@ -68,7 +69,7 @@ public:
                     : user(u), auth(a) {}
                 CHG_AFTER_NOTIFIER(const CHG_AFTER_NOTIFIER<T> & rvalue)
                     : user(rvalue.user), auth(rvalue.auth) {}
-    void        Notify(const T & oldValue, const T & newValue);
+    void        notify(const T & oldValue, const T & newValue) override;
     UserPtr    GetUser() const { return user; }
 
 private:
@@ -121,31 +122,8 @@ private:
     std::list<CHG_BEFORE_NOTIFIER<STG::UserIPs> > BeforeChgIPNotifierList;
     std::list<CHG_AFTER_NOTIFIER<STG::UserIPs> >  AfterChgIPNotifierList;
 
-    class ADD_USER_NONIFIER: public STG::NotifierBase<UserPtr> {
-    public:
-        explicit ADD_USER_NONIFIER(AUTH_AO & a) : auth(a) {}
-        virtual ~ADD_USER_NONIFIER() {}
-        void Notify(const UserPtr & user) { auth.AddUser(user); }
-
-    private:
-        ADD_USER_NONIFIER(const ADD_USER_NONIFIER & rvalue);
-        ADD_USER_NONIFIER & operator=(const ADD_USER_NONIFIER & rvalue);
-
-        AUTH_AO & auth;
-    } onAddUserNotifier;
-
-    class DEL_USER_NONIFIER: public STG::NotifierBase<UserPtr> {
-    public:
-        explicit DEL_USER_NONIFIER(AUTH_AO & a) : auth(a) {}
-        virtual ~DEL_USER_NONIFIER() {}
-        void Notify(const UserPtr & user) { auth.DelUser(user); }
-
-    private:
-        DEL_USER_NONIFIER(const DEL_USER_NONIFIER & rvalue);
-        DEL_USER_NONIFIER & operator=(const DEL_USER_NONIFIER & rvalue);
-
-        AUTH_AO & auth;
-    } onDelUserNotifier;
+    STG::ScopedConnection m_onAddUserConn;
+    STG::ScopedConnection m_onDelUserConn;
 
     STG::PluginLogger logger;