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 void Notify(const varParamType & oldValue, const varParamType & newValue);
49 void SetUser(user_iter u) { user = u; }
50 user_iter GetUser() {return user; }
51 void SetAuthorizator(const AUTH_AO * a) { auth = a; }
57 //-----------------------------------------------------------------------------
58 template <typename varParamType>
59 class CHG_AFTER_NOTIFIER: public PROPERTY_NOTIFIER_BASE<varParamType>
62 void Notify(const varParamType & oldValue, const varParamType & newValue);
63 void SetUser(user_iter u) { user = u; }
64 user_iter GetUser() {return user; }
65 void SetAuthorizator(const AUTH_AO * a) { auth = a; }
71 //-----------------------------------------------------------------------------
72 class AUTH_AO_SETTINGS
75 const string& GetStrError() const { static string s; return s; }
76 int ParseSettings(const MODULE_SETTINGS &) { return 0; }
78 //-----------------------------------------------------------------------------
79 class AUTH_AO :public BASE_AUTH
85 void SetUsers(USERS * u);
86 void SetTariffs(TARIFFS *){};
87 void SetAdmins(ADMINS *){};
88 void SetTraffcounter(TRAFFCOUNTER *){};
89 void SetStore(BASE_STORE *){};
90 void SetStgSettings(const SETTINGS *){};
94 int Reload() { return 0; };
96 void SetSettings(const MODULE_SETTINGS & s);
98 const string & GetStrError() const;
99 const string GetVersion() const;
100 uint16_t GetStartPosition() const;
101 uint16_t GetStopPosition() const;
103 void AddUser(user_iter u);
104 void DelUser(user_iter u);
106 void UpdateUserAuthorization(user_iter u) const;
107 void Unauthorize(user_iter u) const;
109 int SendMessage(const STG_MSG & msg, uint32_t ip) const;
113 void SetUserNotifiers(user_iter u);
114 void UnSetUserNotifiers(user_iter u);
116 mutable string errorStr;
117 AUTH_AO_SETTINGS aoSettings;
119 list<user_iter> usersList;
121 MODULE_SETTINGS settings;
124 ÍÙ ÄÏÌÖÎÙ ÐÅÒÅÐÒÏ×ÅÒÉÔØ ×ÏÚÍÏÖÎÏÓÔØ Á×ÔÏÒÉÚÁÃÉÉ ÀÚÅÒÁ ÐÒÉ ÉÚÍÅÎÅÎÉÉ
125 ÓÌÅÄÕÀÝÉÈ ÅÇÏ ÐÁÒÁÍÅÔÒÏ×:
130 list<CHG_BEFORE_NOTIFIER<int> > BeforeChgAONotifierList;
131 list<CHG_AFTER_NOTIFIER<int> > AfterChgAONotifierList;
133 list<CHG_BEFORE_NOTIFIER<USER_IPS> > BeforeChgIPNotifierList;
134 list<CHG_AFTER_NOTIFIER<USER_IPS> > AfterChgIPNotifierList;
136 class ADD_USER_NONIFIER: public NOTIFIER_BASE<user_iter>
139 ADD_USER_NONIFIER(){};
140 virtual ~ADD_USER_NONIFIER(){};
142 void SetAuthorizator(AUTH_AO * a) { auth = a; }
143 void Notify(const user_iter & user)
152 class DEL_USER_NONIFIER: public NOTIFIER_BASE<user_iter>
155 DEL_USER_NONIFIER(){};
156 virtual ~DEL_USER_NONIFIER(){};
158 void SetAuthorizator(AUTH_AO * a) { auth = a; }
159 void Notify(const user_iter & user)
169 //-----------------------------------------------------------------------------