mirror of
https://github.com/haiwen/seahub.git
synced 2025-07-11 22:18:59 +00:00
18 lines
456 B
Python
18 lines
456 B
Python
from django.http import Http404
|
|
|
|
from seaserv import check_group_staff
|
|
|
|
def group_staff_required(func):
|
|
"""
|
|
Decorator for views that checks the user is group staff.
|
|
|
|
"""
|
|
def _decorated(request, *args, **kwargs):
|
|
group_id = int(kwargs.get('group_id', '0')) # Checked by URL Conf
|
|
|
|
if check_group_staff(group_id, request.user):
|
|
return func(request, *args, **kwargs)
|
|
raise Http404
|
|
return _decorated
|
|
|