mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-09 16:45:44 -07:00
Added worldprops option noauth_default_admin so admin-by-default can be disabled when use_auth = false, thus making it possible to have singleplayer builds where the player is not automatically given admin rights
This commit is contained in:
parent
455c7b355c
commit
a1e9e4b2a1
5 changed files with 9 additions and 2 deletions
|
|
@ -12,6 +12,8 @@ import java.math.BigInteger
|
|||
*/
|
||||
class ServerConstants {
|
||||
companion object {
|
||||
var NOAUTH_DEFAULT_ADMIN: Boolean = true
|
||||
|
||||
@JvmField
|
||||
var DAILY_ACCOUNT_LIMIT = 3
|
||||
|
||||
|
|
|
|||
|
|
@ -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,6 +24,7 @@ class DevelopmentAuthenticator : AuthProvider<AccountStorageProvider>() {
|
|||
|
||||
override fun createAccountWith(info: UserAccountInfo): Boolean {
|
||||
info.username = info.username.toLowerCase()
|
||||
if (ServerConstants.NOAUTH_DEFAULT_ADMIN)
|
||||
info.rights = 2
|
||||
storageProvider.store(info)
|
||||
return true
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue