2022-11-16 20:14:05 -08:00
|
|
|
from django.contrib.auth.decorators import user_passes_test
|
|
|
|
|
|
|
|
|
2022-12-20 01:01:54 -08:00
|
|
|
def moderator_required(function):
|
|
|
|
return user_passes_test(
|
|
|
|
lambda user: user.is_authenticated and (user.admin or user.moderator)
|
|
|
|
)(function)
|
|
|
|
|
|
|
|
|
2022-11-16 20:14:05 -08:00
|
|
|
def admin_required(function):
|
2022-11-25 17:37:09 -08:00
|
|
|
return user_passes_test(lambda user: user.is_authenticated and user.admin)(function)
|