]> git.lizzy.rs Git - minetest.git/blobdiff - src/server.h
hopefully fixed the privilege problems
[minetest.git] / src / server.h
index 54330856c2d541c8d0606ebea6ede4adc852b21e..7b73e476c54530a563434bea71c00c3b5335a720 100644 (file)
@@ -32,6 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "porting.h"
 #include "map.h"
 #include "inventory.h"
+#include "auth.h"
 
 /*
        Some random functions
@@ -423,7 +424,29 @@ class Server : public con::PeerHandler, public MapEventReceiver,
 
        // Envlock and conlock should be locked when calling this
        void SendMovePlayer(Player *player);
+       
+       u64 getPlayerAuthPrivs(const std::string &name)
+       {
+               try{
+                       return m_authmanager.getPrivs(name);
+               }
+               catch(AuthNotFoundException &e)
+               {
+                       dstream<<"WARNING: Auth not found for "<<name<<std::endl;
+                       return 0;
+               }
+       }
 
+       void setPlayerAuthPrivs(const std::string &name, u64 privs)
+       {
+               try{
+                       return m_authmanager.setPrivs(name, privs);
+               }
+               catch(AuthNotFoundException &e)
+               {
+                       dstream<<"WARNING: Auth not found for "<<name<<std::endl;
+               }
+       }
 
 private:
 
@@ -438,7 +461,8 @@ class Server : public con::PeerHandler, public MapEventReceiver,
        */
        
        static void SendHP(con::Connection &con, u16 peer_id, u8 hp);
-       static void SendAccessDenied(con::Connection &con, u16 peer_id);
+       static void SendAccessDenied(con::Connection &con, u16 peer_id,
+                       const std::wstring &reason);
        
        /*
                Non-static send methods
@@ -491,6 +515,8 @@ class Server : public con::PeerHandler, public MapEventReceiver,
        void handlePeerChange(PeerChange &c);
        void handlePeerChanges();
 
+       u64 getPlayerPrivs(Player *player);
+
        /*
                Variables
        */
@@ -514,6 +540,9 @@ class Server : public con::PeerHandler, public MapEventReceiver,
        JMutex m_con_mutex;
        // Connected clients (behind the con mutex)
        core::map<u16, RemoteClient*> m_clients;
+
+       // User authentication
+       AuthManager m_authmanager;
        
        /*
                Threads