Skip to content

Add a NewUser role with separate perms, minor restricted role handling improvements#1106

Open
Toastbrot236 wants to merge 17 commits into
LittleBigRefresh:mainfrom
Toastbrot236:new-user
Open

Add a NewUser role with separate perms, minor restricted role handling improvements#1106
Toastbrot236 wants to merge 17 commits into
LittleBigRefresh:mainfrom
Toastbrot236:new-user

Conversation

@Toastbrot236

Copy link
Copy Markdown
Contributor

This adds a NewUser role to GameUserRole which is inbetween User and Restricted. Newly created accounts will have their role set toNewUser 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Separate role perms for "new" users

1 participant