Skip to content

Commit

Permalink
hub: fail open in case an invalid acl permission is specified
Browse files Browse the repository at this point in the history
  • Loading branch information
rhyw committed Oct 11, 2023
1 parent 6ee970b commit 7dbc953
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions kobo/hub/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@
raise ImproperlyConfigured("Invalid permissions on '%s'." % dir_path)


if hasattr(settings, "USERS_ACL_PERMISSION"):
acl_permission = getattr(settings, "USERS_ACL_PERMISSION")
valid_options = ["", "authenticated", "staff"]
if acl_permission not in valid_options:
raise ImproperlyConfigured(
f"Invalid USERS_ACL_PERMISSION in settings: '{acl_permission}', must be one of "
f"'authenticated', 'staff' or ''(empty string)"
)


if getattr(settings, "MIDDLEWARE", None) is not None:
# Settings defines Django>=1.10 style middleware, check that
middleware_var = "MIDDLEWARE"
Expand Down

0 comments on commit 7dbc953

Please sign in to comment.