You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f5bb417
Browse filesBrowse the repository at this point in the historyBrowse files
Add a NewUser role with separate perms, minor restricted role handling improvements (#1106)
This adds a `NewUser` role to `GameUserRole` which is inbetween `User`
and `Restricted`. Newly created accounts will have their role set
to`NewUser` instead of `User`. New users have their own, separate
role-perms in `refreshGameServer.json`, and said config now also has an
`HoursUntilNewAccountNoLongerNew` option, which defines how old an
account must be in order to be automatically promoted from new user to
normal user. This automatic promotion is done by `NewUserJob`.
This closes#1098.
Additionally, this PR also does the following:
- Adds separate, hard-coded role-perms and write-block status for the
`Restricted` and `Banned` roles if requested (normally `RoleService`
already takes care of blocking upload requests by such users, but this
is just a fallback incase the service fails, also useful incase we add
other things which need role-perms, and this generally makes the methods
simpler). I've added this in this PR because I already had to edit the
methods to handle new user perms.
- Adds `TimeProvider` to `WorkContext` so we could easily modify the
current time there to test the `NewUserJob`. This doesn't make other
jobs, which also use current time (like `CoolLevelsJob` and
`DiscordIntegrationJob`), use the time provider yet though. That should
be done and tested in another PR.
Also, this PR still needs unit tests for the new config migrations, and
manual testing on a real Refresh instance.
// In version 28, PhotoUploadRateLimit and PlaylistUploadRateLimit were added to RolePermissions, and various renamings related to level upload rate-limiting
103
-
// were done to prepare for this: the class TimedLevelUploadLimitProperties was renamed to EntityUploadRateLimitProperties, its attribute LevelQuota was renamed to UploadQuota,
104
-
// and RolePermissions' attribute TimedLevelUploadLimits was renamed to LevelUploadRateLimit
118
+
// In version 28, PhotoUploadRateLimit and PlaylistUploadRateLimit were added to RolePermissions
119
+
// and various attributes related to level rate-limiting were renamed
context.Logger.LogDebug(RefreshContext.Worker,$"{nameof(NewUserJob)} - new user: {user}, join date: {user.JoinDate}, current time: {now}, account age: {accountAge}h, configured required age: {this._requiredAccountAge}h.");
34
+
if(accountAge<this._requiredAccountAge)continue;// Don't promote user if they haven't reached max age yet
35
+
36
+
context.Logger.LogInfo(RefreshContext.Worker,$"Promoting {user} to regular user since their account is {accountAge} hours old now (configured required age: {this._requiredAccountAge}h).");
0 commit comments