summaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_auth.h
diff options
context:
space:
mode:
authorBen Deutsch <ben@bendeutsch.de>2018-08-05 13:13:38 +0200
committerLoïc Blot <nerzhul@users.noreply.github.com>2018-08-05 13:13:38 +0200
commit153fb211ac2342907eb766a79c1f41824f981ab5 (patch)
tree58a927bbf9a7d3d3811df6a703de02362b6474fb /src/script/lua_api/l_auth.h
parent18368824958139f1428d534082852d778982b4c9 (diff)
downloadminetest-153fb211ac2342907eb766a79c1f41824f981ab5.tar.gz
minetest-153fb211ac2342907eb766a79c1f41824f981ab5.tar.bz2
minetest-153fb211ac2342907eb766a79c1f41824f981ab5.zip
Replace auth.txt with SQLite auth database (#7279)
* Replace auth.txt with SQLite auth database
Diffstat (limited to 'src/script/lua_api/l_auth.h')
-rw-r--r--src/script/lua_api/l_auth.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/script/lua_api/l_auth.h b/src/script/lua_api/l_auth.h
new file mode 100644
index 000000000..fb9a9875b
--- /dev/null
+++ b/src/script/lua_api/l_auth.h
@@ -0,0 +1,54 @@
+/*
+Minetest
+Copyright (C) 2018 bendeutsch, Ben Deutsch <ben@bendeutsch.de>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+
+#pragma once
+
+#include "lua_api/l_base.h"
+
+class AuthDatabase;
+struct AuthEntry;
+
+class ModApiAuth : public ModApiBase
+{
+private:
+ // auth_read(name)
+ static int l_auth_read(lua_State *L);
+
+ // auth_save(table)
+ static int l_auth_save(lua_State *L);
+
+ // auth_create(table)
+ static int l_auth_create(lua_State *L);
+
+ // auth_delete(name)
+ static int l_auth_delete(lua_State *L);
+
+ // auth_list_names()
+ static int l_auth_list_names(lua_State *L);
+
+ // auth_reload()
+ static int l_auth_reload(lua_State *L);
+
+ // helper for auth* methods
+ static AuthDatabase *getAuthDb(lua_State *L);
+ static void pushAuthEntry(lua_State *L, const AuthEntry &authEntry);
+
+public:
+ static void Initialize(lua_State *L, int top);
+};