takahe/users/decorators.py
Andrew Godwin 8f57aa5f37
UI/Domains Refactor
Redoes the UI to remove timelines, promote domains, and a lot of other things to support the refactor.
2023-05-03 22:42:37 -06:00

11 lines
340 B
Python

from django.contrib.auth.decorators import user_passes_test
def moderator_required(function):
return user_passes_test(
lambda user: user.is_authenticated and (user.admin or user.moderator)
)(function)
def admin_required(function):
return user_passes_test(lambda user: user.is_authenticated and user.admin)(function)