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,7 +12,9 @@ import java.math.BigInteger
|
||||||
*/
|
*/
|
||||||
class ServerConstants {
|
class ServerConstants {
|
||||||
companion object {
|
companion object {
|
||||||
@JvmField
|
var NOAUTH_DEFAULT_ADMIN: Boolean = true
|
||||||
|
|
||||||
|
@JvmField
|
||||||
var DAILY_ACCOUNT_LIMIT = 3
|
var DAILY_ACCOUNT_LIMIT = 3
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package rs09.auth
|
package rs09.auth
|
||||||
|
|
||||||
import core.game.node.entity.player.Player
|
import core.game.node.entity.player.Player
|
||||||
|
import rs09.ServerConstants
|
||||||
import rs09.storage.AccountStorageProvider
|
import rs09.storage.AccountStorageProvider
|
||||||
import rs09.storage.InMemoryStorageProvider
|
import rs09.storage.InMemoryStorageProvider
|
||||||
|
|
||||||
|
|
@ -23,7 +24,8 @@ class DevelopmentAuthenticator : AuthProvider<AccountStorageProvider>() {
|
||||||
|
|
||||||
override fun createAccountWith(info: UserAccountInfo): Boolean {
|
override fun createAccountWith(info: UserAccountInfo): Boolean {
|
||||||
info.username = info.username.toLowerCase()
|
info.username = info.username.toLowerCase()
|
||||||
info.rights = 2
|
if (ServerConstants.NOAUTH_DEFAULT_ADMIN)
|
||||||
|
info.rights = 2
|
||||||
storageProvider.store(info)
|
storageProvider.store(info)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -125,6 +125,7 @@ object ServerConfigParser {
|
||||||
ServerConstants.PERSIST_ACCOUNTS = data.getBoolean("server.persist_accounts", true)
|
ServerConstants.PERSIST_ACCOUNTS = data.getBoolean("server.persist_accounts", true)
|
||||||
ServerConstants.DAILY_ACCOUNT_LIMIT = data.getLong("server.daily_accounts_per_ip", 3L).toInt()
|
ServerConstants.DAILY_ACCOUNT_LIMIT = data.getLong("server.daily_accounts_per_ip", 3L).toInt()
|
||||||
ServerConstants.DISCORD_MOD_WEBHOOK = data.getString("server.moderation_webhook", "")
|
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"
|
secret_key = "2009scape_development"
|
||||||
write_logs = true
|
write_logs = true
|
||||||
msip = "127.0.0.1"
|
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]
|
||||||
database_name = "global"
|
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
|
#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.
|
#NOTE: this does not affect actual save data, like stats, inventory, etc.
|
||||||
persist_accounts = false #NOTE: THIS MUST BE SET TO TRUE IN PRODUCTION!
|
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.
|
#The limit on how many different accounts a player can log into per day.
|
||||||
daily_accounts_per_ip = 3
|
daily_accounts_per_ip = 3
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue