From 544f65a522d8a001e2effe49a81d8c00ef5e1685 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 11 May 2025 22:40:26 +0200 Subject: [PATCH] Docs for the UserManager implementations. --- modules/users/doc_classes/UserManagerDB.xml | 45 +++++++++++++++++++ modules/users/doc_classes/UserManagerFile.xml | 4 ++ .../users/doc_classes/UserManagerStatic.xml | 9 ++++ 3 files changed, 58 insertions(+) diff --git a/modules/users/doc_classes/UserManagerDB.xml b/modules/users/doc_classes/UserManagerDB.xml index 8f8f6a55c..722cb56b6 100644 --- a/modules/users/doc_classes/UserManagerDB.xml +++ b/modules/users/doc_classes/UserManagerDB.xml @@ -1,8 +1,30 @@ + A UserManager implementation that uses databases to store [User]s. + A UserManager implementation that uses databases to store [User]s. + Either uses the [Database] set to it's [code]database[/code] property, or it uses the default database. + Uses the database module, so it's only available if it's enabled during compile time. + The current default database cration code: + [code]var tb : TableBuilder = get_table_builder() + tb.create_table(_database_table_name) + tb.integer("id").auto_increment().next_row() + tb.varchar("username", 60).not_null().next_row() + tb.varchar("username_internal", 60).not_null().next_row() + tb.varchar("email", 100).not_null().next_row() + tb.varchar("email_internal", 100).not_null().next_row() + tb.integer("rank").not_null().next_row() + tb.varchar("pre_salt", 100).next_row() + tb.varchar("post_salt", 100).next_row() + tb.varchar("password_hash", 100).next_row() + tb.integer("banned").next_row() + tb.varchar("password_reset_token", 100).next_row() + tb.integer("locked").next_row() + tb.primary_key("id") + tb.ccreate_table() + tb.run_query()[/code] @@ -11,16 +33,20 @@ + Override this method to create default user entries when the database gets seeded. + By default this does not create anything. + Create the required table(s). + Drop the required table(s). @@ -29,43 +55,55 @@ + Standard migration method called by the database singleton. + Update your tables if necessary. + [method _migrate] calls this when needed. + [method _migrate] calls this when needed. + Calls [method _create_default_entries]. + Creates the required table(s). + Calls [method _create_table]. + Drop the required table(s). + Calls [method _drop_table]. + Get a [DatabaseConnection] from the current database. + Get a [QueryBuilder] from the current database. + Get a [TableBuilder] from the current database. @@ -74,19 +112,26 @@ + Standard migration method called by the database singleton. + Calls [method _migrate]. + Update your tables if necessary. + [method _migrate] calls this when needed. + Calls [method _update_table]. + Lets you set a custom [Database] to be used if [DatabaseManager.ddb] isn't desired. + Lets you specify a table name. diff --git a/modules/users/doc_classes/UserManagerFile.xml b/modules/users/doc_classes/UserManagerFile.xml index 5113d93ae..a758d4ef1 100644 --- a/modules/users/doc_classes/UserManagerFile.xml +++ b/modules/users/doc_classes/UserManagerFile.xml @@ -1,8 +1,11 @@ + A UserManager implementation that uses file to store [User]s. + A UserManager implementation that uses file to store [User]s. + Uses one file per user, and stores data in the json format, so An exclusive folder is recommended that is not used by anything else. @@ -10,6 +13,7 @@ + The folder where the user data will be stored. diff --git a/modules/users/doc_classes/UserManagerStatic.xml b/modules/users/doc_classes/UserManagerStatic.xml index 81c459a2d..af257edc5 100644 --- a/modules/users/doc_classes/UserManagerStatic.xml +++ b/modules/users/doc_classes/UserManagerStatic.xml @@ -1,8 +1,13 @@ + A UserManager implementation that stores users using it's properties inside the tree. + A UserManager implementation that stores users using it's properties inside the tree. + Users can be created inside the editor using the inspector. + Can be used for testing, and maybe for small non-public facing applications. + It's data is serialized with the scene, so it will get restored on restart. @@ -10,12 +15,16 @@ + Used by the editor. + Used by the editor. + Used by the editor. + The list of stored [User]s.