physics_workload.app.auth

Adds access-checking functions that test the permissions on the model.

Functions

has_access_decoder(→ Callable[[str, ...)

Factory for making access decoders for a given model

has_staff_access(→ bool)

Checks if the user is signed in and staff, or if security is off for debugging.

Module Contents

physics_workload.app.auth.has_access_decoder(model: Type[app.models.common.ModelCommon], message: str) Callable[[str, django.http.HttpRequest, Unpack[Any]], app.models.common.ModelCommon]

Factory for making access decoders for a given model :param model: The model to create the decoder for. :param message: The message to show on failed access. :return: A function that decodes access for that model

physics_workload.app.auth.has_staff_access(user: django.contrib.auth.models.AbstractUser | django.contrib.auth.models.AnonymousUser) bool

Checks if the user is signed in and staff, or if security is off for debugging.

Parameters:

user

Returns: