diff --git a/Server/src/main/kotlin/rs09/ServerConstants.kt b/Server/src/main/kotlin/rs09/ServerConstants.kt index 62be424cc..9425830f1 100644 --- a/Server/src/main/kotlin/rs09/ServerConstants.kt +++ b/Server/src/main/kotlin/rs09/ServerConstants.kt @@ -12,7 +12,9 @@ import java.math.BigInteger */ class ServerConstants { companion object { - @JvmField + var NOAUTH_DEFAULT_ADMIN: Boolean = true + + @JvmField var DAILY_ACCOUNT_LIMIT = 3 @JvmField diff --git a/Server/src/main/kotlin/rs09/auth/DevelopmentAuthenticator.kt b/Server/src/main/kotlin/rs09/auth/DevelopmentAuthenticator.kt index 334d85ae7..bd20e1fc1 100644 --- a/Server/src/main/kotlin/rs09/auth/DevelopmentAuthenticator.kt +++ b/Server/src/main/kotlin/rs09/auth/DevelopmentAuthenticator.kt @@ -1,6 +1,7 @@ package rs09.auth import core.game.node.entity.player.Player +import rs09.ServerConstants import rs09.storage.AccountStorageProvider import rs09.storage.InMemoryStorageProvider @@ -23,7 +24,8 @@ class DevelopmentAuthenticator : AuthProvider() { override fun createAccountWith(info: UserAccountInfo): Boolean { info.username = info.username.toLowerCase() - info.rights = 2 + if (ServerConstants.NOAUTH_DEFAULT_ADMIN) + info.rights = 2 storageProvider.store(info) return true } diff --git a/Server/src/main/kotlin/rs09/game/system/config/ServerConfigParser.kt b/Server/src/main/kotlin/rs09/game/system/config/ServerConfigParser.kt index a05d268ff..3dc3574e7 100644 --- a/Server/src/main/kotlin/rs09/game/system/config/ServerConfigParser.kt +++ b/Server/src/main/kotlin/rs09/game/system/config/ServerConfigParser.kt @@ -125,6 +125,7 @@ object ServerConfigParser { ServerConstants.PERSIST_ACCOUNTS = data.getBoolean("server.persist_accounts", true) ServerConstants.DAILY_ACCOUNT_LIMIT = data.getLong("server.daily_accounts_per_ip", 3L).toInt() ServerConstants.DISCORD_MOD_WEBHOOK = data.getString("server.moderation_webhook", "") + ServerConstants.NOAUTH_DEFAULT_ADMIN = data.getBoolean("server.noauth_default_admin", false) } diff --git a/Server/src/test/resources/test.conf b/Server/src/test/resources/test.conf index 64fee2d6f..97ca19a32 100644 --- a/Server/src/test/resources/test.conf +++ b/Server/src/test/resources/test.conf @@ -4,6 +4,7 @@ secret_key = "2009scape_development" write_logs = true msip = "127.0.0.1" +noauth_default_admin = true #NOTE: If we are not using auth, this determines whether or not players are admins by default. [database] database_name = "global" diff --git a/Server/worldprops/default.conf b/Server/worldprops/default.conf index b78154754..8bdb499da 100644 --- a/Server/worldprops/default.conf +++ b/Server/worldprops/default.conf @@ -12,6 +12,7 @@ use_auth = false #NOTE: THIS MUST BE SET TO TRUE IN PRODUCTION! #true - account data (credits, playtime, etc) is persisted, false - account data is purely temporary #NOTE: this does not affect actual save data, like stats, inventory, etc. persist_accounts = false #NOTE: THIS MUST BE SET TO TRUE IN PRODUCTION! +noauth_default_admin = true #NOTE: If we are not using auth, this determines whether or not players are admins by default. #------------------------------------------------------------------------------------------------------ #The limit on how many different accounts a player can log into per day. daily_accounts_per_ip = 3