2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
23 $Date: 2010/09/10 06:38:26 $
32 #include "base_auth.h"
33 #include "base_store.h"
36 #include "../../../users.h"
40 extern "C" BASE_PLUGIN * GetPlugin();
43 //-----------------------------------------------------------------------------
44 template <typename varParamType>
45 class CHG_BEFORE_NOTIFIER: public PROPERTY_NOTIFIER_BASE<varParamType>
48 CHG_BEFORE_NOTIFIER(AUTH_AO & a, user_iter u) : user(u), auth(a) {}
49 void Notify(const varParamType & oldValue, const varParamType & newValue);
50 //void SetUser(user_iter u) { user = u; }
51 user_iter GetUser() {return user; }
52 //void SetAuthorizator(const AUTH_AO * a) { auth = a; }
58 //-----------------------------------------------------------------------------
59 template <typename varParamType>
60 class CHG_AFTER_NOTIFIER: public PROPERTY_NOTIFIER_BASE<varParamType>
63 CHG_AFTER_NOTIFIER(AUTH_AO & a, user_iter u) : user(u), auth(a) {}
64 void Notify(const varParamType & oldValue, const varParamType & newValue);
65 //void SetUser(user_iter u) { user = u; }
66 user_iter GetUser() {return user; }
67 //void SetAuthorizator(const AUTH_AO * a) { auth = a; }
73 //-----------------------------------------------------------------------------
74 class AUTH_AO_SETTINGS
77 const string& GetStrError() const { static string s; return s; }
78 int ParseSettings(const MODULE_SETTINGS &) { return 0; }
80 //-----------------------------------------------------------------------------
81 class AUTH_AO :public BASE_AUTH
87 void SetUsers(USERS * u);
88 void SetTariffs(TARIFFS *){};
89 void SetAdmins(ADMINS *){};
90 void SetTraffcounter(TRAFFCOUNTER *){};
91 void SetStore(BASE_STORE *){};
92 void SetStgSettings(const SETTINGS *){};
96 int Reload() { return 0; };
98 void SetSettings(const MODULE_SETTINGS & s);
100 const string & GetStrError() const;
101 const string GetVersion() const;
102 uint16_t GetStartPosition() const;
103 uint16_t GetStopPosition() const;
105 void AddUser(user_iter u);
106 void DelUser(user_iter u);
108 void UpdateUserAuthorization(user_iter u) const;
109 void Unauthorize(user_iter u) const;
111 int SendMessage(const STG_MSG & msg, uint32_t ip) const;
115 void SetUserNotifiers(user_iter u);
116 void UnSetUserNotifiers(user_iter u);
118 mutable string errorStr;
119 AUTH_AO_SETTINGS aoSettings;
121 list<user_iter> usersList;
123 MODULE_SETTINGS settings;
126 ÍÙ ÄÏÌÖÎÙ ÐÅÒÅÐÒÏ×ÅÒÉÔØ ×ÏÚÍÏÖÎÏÓÔØ Á×ÔÏÒÉÚÁÃÉÉ ÀÚÅÒÁ ÐÒÉ ÉÚÍÅÎÅÎÉÉ
127 ÓÌÅÄÕÀÝÉÈ ÅÇÏ ÐÁÒÁÍÅÔÒÏ×:
132 list<CHG_BEFORE_NOTIFIER<int> > BeforeChgAONotifierList;
133 list<CHG_AFTER_NOTIFIER<int> > AfterChgAONotifierList;
135 list<CHG_BEFORE_NOTIFIER<USER_IPS> > BeforeChgIPNotifierList;
136 list<CHG_AFTER_NOTIFIER<USER_IPS> > AfterChgIPNotifierList;
138 class ADD_USER_NONIFIER: public NOTIFIER_BASE<user_iter>
141 ADD_USER_NONIFIER(AUTH_AO & a) : auth(a) {};
142 virtual ~ADD_USER_NONIFIER(){};
144 //void SetAuthorizator(AUTH_AO * a) { auth = a; }
145 void Notify(const user_iter & user)
154 class DEL_USER_NONIFIER: public NOTIFIER_BASE<user_iter>
157 DEL_USER_NONIFIER(AUTH_AO & a) : auth(a) {};
158 virtual ~DEL_USER_NONIFIER(){};
160 //void SetAuthorizator(AUTH_AO * a) { auth = a; }
161 void Notify(const user_iter & user)
171 //-----------------------------------------------------------------------------