mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-16 07:08:55 +00:00
[invitation] Enable sysadmin to remove invitations
This commit is contained in:
@@ -12,8 +12,9 @@
|
||||
<th width="25%">{% trans "Inviter" %}</th>
|
||||
<th width="25%">{% trans "Accepter" %}</th>
|
||||
<th width="10%">{% trans "Type" %}</th>
|
||||
<th width="20%">{% trans "Invited at" %}</th>
|
||||
<th width="20%">{% trans "Accepted at" %}</th>
|
||||
<th width="16%">{% trans "Invited at" %}</th>
|
||||
<th width="16%">{% trans "Accepted at" %}</th>
|
||||
<th width="8%"></th>
|
||||
</tr>
|
||||
{% for invitation in invitations %}
|
||||
<tr>
|
||||
@@ -30,6 +31,7 @@
|
||||
{% else %}
|
||||
<td>--</td>
|
||||
{% endif %}
|
||||
<td><a class="op vh rm-link" href="#" data-id="{{invitation.pk}}">{% trans "Delete" %}</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
@@ -44,5 +46,21 @@
|
||||
|
||||
{% block extra_script %}
|
||||
<script type="text/javascript">
|
||||
$('.rm-link').click(function() {
|
||||
var _this = $(this);
|
||||
$.ajax({
|
||||
url: '{% url 'sys_invitation_remove' %}',
|
||||
type: 'POST',
|
||||
data: {'inv_id': _this.attr('data-id')},
|
||||
cache: false,
|
||||
dataType: 'json',
|
||||
beforeSend: prepareCSRFToken,
|
||||
success: function() {
|
||||
_this.closest('tr').remove();
|
||||
},
|
||||
error: ajaxErrorHandler
|
||||
});
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
@@ -348,6 +348,7 @@ urlpatterns = patterns(
|
||||
url(r'^sys/uploadlink/remove/$', sys_upload_link_remove, name='sys_upload_link_remove'),
|
||||
url(r'^sys/notificationadmin/', notification_list, name='notification_list'),
|
||||
url(r'^sys/invitationadmin/$', sys_invitation_admin, name='sys_invitation_admin'),
|
||||
url(r'^sys/invitationadmin/remove/$', sys_invitation_remove, name='sys_invitation_remove'),
|
||||
url(r'^sys/sudo/', sys_sudo_mode, name='sys_sudo_mode'),
|
||||
url(r'^sys/check-license/', sys_check_license, name='sys_check_license'),
|
||||
url(r'^useradmin/add/$', user_add, name="user_add"),
|
||||
|
@@ -16,7 +16,7 @@ from django.conf import settings as dj_settings
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.contrib import messages
|
||||
from django.http import HttpResponse, Http404, HttpResponseRedirect, HttpResponseNotAllowed
|
||||
from django.shortcuts import render_to_response
|
||||
from django.shortcuts import render_to_response, get_object_or_404
|
||||
from django.template import RequestContext
|
||||
from django.utils import timezone
|
||||
from django.utils.translation import ugettext as _
|
||||
@@ -2316,6 +2316,27 @@ def sys_invitation_admin(request):
|
||||
},
|
||||
context_instance=RequestContext(request))
|
||||
|
||||
@login_required
|
||||
@sys_staff_required
|
||||
def sys_invitation_remove(request):
|
||||
"""Delete an invitation.
|
||||
"""
|
||||
ct = 'application/json; charset=utf-8'
|
||||
result = {}
|
||||
|
||||
if not ENABLE_GUEST_INVITATION:
|
||||
return HttpResponse(json.dumps({}), status=400, content_type=ct)
|
||||
|
||||
inv_id = request.POST.get('inv_id', '')
|
||||
if not inv_id:
|
||||
result = {'error': "Argument missing"}
|
||||
return HttpResponse(json.dumps(result), status=400, content_type=ct)
|
||||
|
||||
inv = get_object_or_404(Invitation, pk=inv_id)
|
||||
inv.delete()
|
||||
|
||||
return HttpResponse(json.dumps({'success': True}), content_type=ct)
|
||||
|
||||
@login_required
|
||||
@sys_staff_required
|
||||
def sys_terms_admin(request):
|
||||
|
Reference in New Issue
Block a user