]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/authorization/ao/ao.cpp
Various fixes of issues reported by static analyzers.
[stg.git] / projects / stargazer / plugins / authorization / ao / ao.cpp
index 9640e2e8b218de94a5cce005753a618c8e5e1c7b..853df2a4f8595162380ca873106c5ee1afb93f5e 100644 (file)
@@ -56,7 +56,7 @@ template <typename varType>
 class IS_CONTAINS_USER: public std::binary_function<varType, USER_PTR, bool>
 {
 public:
-    bool operator()(varType notifier, USER_PTR user) const
+    bool operator()(const varType& notifier, USER_PTR user) const
         {
         return notifier.GetUser() == user;
         }
@@ -70,15 +70,8 @@ return "Always Online authorizator v.1.0";
 }
 //-----------------------------------------------------------------------------
 AUTH_AO::AUTH_AO()
-    : errorStr(),
-      users(NULL),
-      usersList(),
+    : users(NULL),
       isRunning(false),
-      settings(),
-      BeforeChgAONotifierList(),
-      AfterChgAONotifierList(),
-      BeforeChgIPNotifierList(),
-      AfterChgIPNotifierList(),
       onAddUserNotifier(*this),
       onDelUserNotifier(*this),
       logger(GetPluginLogger(GetStgLogger(), "auth_ao"))
@@ -242,7 +235,8 @@ UpdateUserAuthorization(u);
 //-----------------------------------------------------------------------------
 void AUTH_AO::DelUser(USER_PTR u)
 {
-users->Unauthorize(u->GetLogin(), this);
+if (u->IsAuthorizedBy(this))
+    users->Unauthorize(u->GetLogin(), this);
 UnSetUserNotifiers(u);
 usersList.remove(u);
 }