DEV: Change anonymous_posting_min_trust_level to a group-based setting (#24072)

No plugins or themes rely on anonymous_posting_min_trust_level so we
can just switch straight over to anonymous_posting_allowed_groups

This also adds an AUTO_GROUPS const which can be imported in JS
tests which is analogous to the one defined in group.rb. This can be used
to set the current user's groups where JS tests call for checking these groups
against site settings.

Finally a AtLeastOneGroupValidator validator is added for group_list site
settings which ensures that at least one group is always selected, since if
you want to allow all users to use a feature in this way you can just use
the everyone group.
This commit is contained in:
Martin Brennan
2023-10-25 11:45:10 +10:00
committed by GitHub
parent 5e395d4382
commit 9db4eaa870
21 changed files with 223 additions and 72 deletions

View File

@@ -15,10 +15,9 @@ export default class AdminRoute extends DiscourseRoute {
activate() {
if (
!this.currentUser.isInAnyGroups(
this.siteSettings.groupSettingArray(
"enable_experimental_admin_ui_groups"
)
!this.siteSettings.userInAnyGroups(
"enable_experimental_admin_ui_groups",
this.currentUser
)
) {
return DiscourseURL.redirectTo("/admin");