mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-16 15:19:06 +00:00
Modified group adding member
This commit is contained in:
17
group/decorators.py
Normal file
17
group/decorators.py
Normal file
@@ -0,0 +1,17 @@
|
||||
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
|
||||
|
Reference in New Issue
Block a user