Commit 32f4e1c2 by Oláh István Gergely

dashboard: remove group user in view and template

parent bee83c92
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
<thead><tr><th></th><th>{% trans "Who" %}</th><th></th><th></th></tr></thead> <thead><tr><th></th><th>{% trans "Who" %}</th><th></th><th></th></tr></thead>
{% for i in users %} {% for i in users %}
<tr><td><i class="icon-user"></i></td><td>{{i.username}}</td> <tr><td><i class="icon-user"></i></td><td>{{i.username}}</td>
<td><a data-group-pk="{{ i.pk }}" href="#" class="real-link groupuser-delete btn btn-link btn-xs"><i class="icon-remove"><span class="sr-only">{% trans "remove" %}</span></i></a></td></tr> <td><a data-groupmember-pk="{{i.pk}}" href="{% url "dashboard.views.remove-groupmember" user_pk=i.pk group_pk=group.pk %}?next={{ request.path }}" class="real-link groupmember-delete btn btn-link btn-xs"><i class="icon-remove"><span class="sr-only">{% trans "remove" %}</span></i></a></td></tr>
{% endfor %} {% endfor %}
<tr><td><i class="icon-plus"></i></td> <tr><td><i class="icon-plus"></i></td>
<td><input type="text" class="form-control" name="perm-new-name" <td><input type="text" class="form-control" name="perm-new-name"
......
from django.conf.urls import patterns, url from django.conf.urls import patterns, url
from vm.models import Instance
from .views import ( from .views import (
AclUpdateView, DiskAddView, FavouriteView, GroupAclUpdateView, GroupDelete, AclUpdateView, DiskAddView, FavouriteView, GroupAclUpdateView,
GroupDetailView, GroupList, GroupUserDelete, IndexView, LeaseCreate, GroupDelete, GroupDetailView, GroupList, GroupUserDelete,
LeaseDelete, LeaseDetail, MyPreferencesView, NodeAddTraitView, NodeCreate, IndexView, LeaseCreate, LeaseDelete, LeaseDetail, MyPreferencesView,
NodeDelete, NodeDetailView, NodeFlushView, NodeGraphView, NodeList, NodeAddTraitView, NodeCreate, NodeDelete, NodeDetailView, NodeFlushView,
NodeStatus, NotificationView, PortDelete, TemplateAclUpdateView, NodeGraphView, NodeList, NodeStatus, NotificationView, PortDelete,
TemplateCreate, TemplateDelete, TemplateDetail, TemplateList, TemplateAclUpdateView, TemplateCreate, TemplateDelete, TemplateDetail,
TransferOwnershipConfirmView, TransferOwnershipView, vm_activity, VmCreate, TemplateList, TransferOwnershipConfirmView, TransferOwnershipView,
VmDelete, VmDetailView, VmDetailVncTokenView, VmGraphView, VmList, vm_activity, VmCreate, VmDelete, VmDetailView, VmDetailVncTokenView,
VmMassDelete, VmMigrateView, VmRenewView, VmGraphView, VmList, VmMassDelete, VmMigrateView, VmRenewView,
GroupAclRemoveView, GroupMemberRemoveView
) )
from vm.models import Instance
urlpatterns = patterns( urlpatterns = patterns(
'', '',
...@@ -93,7 +95,6 @@ urlpatterns = patterns( ...@@ -93,7 +95,6 @@ urlpatterns = patterns(
name='dashboard.views.group-acl'), name='dashboard.views.group-acl'),
url(r'^groupuser/delete/(?P<pk>\d+)/$', GroupUserDelete.as_view(), url(r'^groupuser/delete/(?P<pk>\d+)/$', GroupUserDelete.as_view(),
name="dashboard.views.delete-groupuser"), name="dashboard.views.delete-groupuser"),
url(r'^notifications/$', NotificationView.as_view(), url(r'^notifications/$', NotificationView.as_view(),
name="dashboard.views.notifications"), name="dashboard.views.notifications"),
...@@ -101,4 +102,10 @@ urlpatterns = patterns( ...@@ -101,4 +102,10 @@ urlpatterns = patterns(
name="dashboard.views.disk-add"), name="dashboard.views.disk-add"),
url(r'^profile/$', MyPreferencesView.as_view(), url(r'^profile/$', MyPreferencesView.as_view(),
name="dashboard.views.profile"), name="dashboard.views.profile"),
url(r'^group/(?P<group_pk>\d+)/remove/acl/(?P<user_pk>\d+)/$',
GroupAclRemoveView.as_view(),
name="dashboard.views.remove-groupaclmember"),
url(r'^group/(?P<group_pk>\d+)/remove/member/(?P<user_pk>\d+)/$',
GroupMemberRemoveView.as_view(),
name="dashboard.views.remove-groupmember"),
) )
...@@ -986,7 +986,7 @@ class GroupUserDelete(LoginRequiredMixin, SuperuserRequiredMixin, DeleteView): ...@@ -986,7 +986,7 @@ class GroupUserDelete(LoginRequiredMixin, SuperuserRequiredMixin, DeleteView):
return reverse_lazy('dashboard.index') return reverse_lazy('dashboard.index')
class GroupUserRemoveView(LoginRequiredMixin, DeleteView): class GroupMemberRemoveView(LoginRequiredMixin, DeleteView):
model = Group model = Group
slug_field = 'pk' slug_field = 'pk'
slug_url_kwarg = 'group_pk' slug_url_kwarg = 'group_pk'
...@@ -1026,7 +1026,7 @@ class GroupUserRemoveView(LoginRequiredMixin, DeleteView): ...@@ -1026,7 +1026,7 @@ class GroupUserRemoveView(LoginRequiredMixin, DeleteView):
return HttpResponseRedirect(success_url) return HttpResponseRedirect(success_url)
class GroupAclRemoveView(GroupUserRemoveView): class GroupAclRemoveView(GroupMemberRemoveView):
def remove_user(self, userpk): def remove_user(self, userpk):
container = self.get_object().profile container = self.get_object().profile
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment