mirror of
https://github.com/jointakahe/takahe.git
synced 2025-01-21 20:08:06 +00:00
11 lines
340 B
Python
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)
|