From 1433eef11b10b6cb060e7d01fb9f448f58d7e6a8 Mon Sep 17 00:00:00 2001 From: ffont Date: Thu, 18 Apr 2024 15:42:40 +0200 Subject: [PATCH] Fix beta search features permissions --- DEVELOPERS.md | 2 +- accounts/fixtures/user_groups.json | 14 ++++++++++++++ utils/search/search_sounds.py | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/DEVELOPERS.md b/DEVELOPERS.md index a3f001329..a881b89d9 100644 --- a/DEVELOPERS.md +++ b/DEVELOPERS.md @@ -71,7 +71,7 @@ Currently, we only use the following custom permissions: * `tickets.can_moderate` (in `Ticket` model, used to allow sound moderation) * `forum.can_moderate_forum` (in `Post` model, used to allow forum moderation) * `sounds.can_describe_in_bulk` (in `BulkUploadProgress` model, used to allow bulk upload for users who don't meet the other common requirements) -* `profile.show_beta_search_options` (in `Profile` model, used to allow using beta search features) +* `profile.can_beta_test` (in `Profile` model, used to allow using beta search features) ### URLs that include a username diff --git a/accounts/fixtures/user_groups.json b/accounts/fixtures/user_groups.json index f82180a26..383208fc6 100644 --- a/accounts/fixtures/user_groups.json +++ b/accounts/fixtures/user_groups.json @@ -128,5 +128,19 @@ ] ] } +}, +{ + "model": "auth.group", + "pk": 10, + "fields": { + "name": "beta_testers", + "permissions": [ + [ + "can_beta_test", + "accounts", + "profile" + ] + ] + } } ] \ No newline at end of file diff --git a/utils/search/search_sounds.py b/utils/search/search_sounds.py index 6e673f521..a29c094d3 100644 --- a/utils/search/search_sounds.py +++ b/utils/search/search_sounds.py @@ -223,5 +223,5 @@ def get_sound_ids_from_search_engine_query(query_params, current_page=None, num_ def allow_beta_search_features(request): if not request.user.is_authenticated: return False - if request.user.has_perm('profile.show_beta_search_options'): + if request.user.has_perm('profile.can_beta_test'): return True