manager: remove some unused code (#31222)

This commit is contained in:
Valentin Deniaud 2019-03-14 11:44:32 +01:00
parent 26dd7e67b6
commit 14361e000b
4 changed files with 0 additions and 82 deletions

View File

@ -190,42 +190,6 @@ class RoleMembersView(views.HideOUColumnMixin, RoleViewMixin, views.BaseSubTable
members = RoleMembersView.as_view()
class RoleChildrenView(views.HideOUColumnMixin, RoleViewMixin, views.BaseSubTableView):
template_name = 'authentic2/manager/role_children.html'
table_class = tables.RoleChildrenTable
form_class = forms.ChooseRoleForm
search_form_class = forms.RoleSearchForm
success_url = '.'
permissions = ['a2_rbac.view_role']
def get_table_queryset(self):
return self.object.children(include_self=False, annotate=True)
def form_valid(self, form):
RoleParenting = get_role_parenting_model()
role = form.cleaned_data['role']
action = form.cleaned_data['action']
if self.can_change:
if action == 'add':
if RoleParenting.objects.filter(parent=self.object, child=role,
direct=True).exists():
messages.warning(self.request, _('Role "%s" is already a '
'child of this role.') % role.name)
else:
self.object.add_child(role)
hooks.call_hooks('event', name='manager-add-child-role',
user=self.request.user, parent=self.object, child=role)
elif action == 'remove':
hooks.call_hooks('event', name='manager-remove-child-role',
user=self.request.user, parent=self.object, child=role)
self.object.remove_child(role)
else:
messages.warning(self.request, _('You are not authorized'))
return super(RoleChildrenView, self).form_valid(form)
children = RoleChildrenView.as_view()
class RoleDeleteView(RoleViewMixin, views.BaseDeleteView):
title = _('Delete role')
template_name = 'authentic2/manager/role_delete.html'

View File

@ -93,21 +93,6 @@ class OUTable(tables.Table):
empty_text = _('None')
class RoleChildrenTable(tables.Table):
name = tables.LinkColumn(viewname='a2-manager-role-members',
kwargs={'pk': A('pk')},
accessor='name', verbose_name=_('name'))
ou = tables.Column()
service = tables.Column(order_by='servicerole__service')
is_direct = tables.BooleanColumn(verbose_name=_('Direct child'))
class Meta:
models = get_role_model()
attrs = {'class': 'main', 'id': 'role-table'}
fields = ('name', 'ou', 'service')
empty_text = _('None')
class OuUserRolesTable(tables.Table):
name = tables.LinkColumn(viewname='a2-manager-role-members',
kwargs={'pk': A('pk')},

View File

@ -1,19 +0,0 @@
{% extends "authentic2/manager/table.html" %}
{% load i18n %}
{% block table.head.last.column %}
{% if perms.a2_rbac.delete_organizationalunit %}
<th></th>
{% endif %}
{% endblock %}
{% block table.tbody.last.column %}
{% if perms.a2_rbac.delete_organizationalunit %}
{% if row.record.default %}
<td><a class="icon-remove-sign disabled"
title="{% trans "You cannot delete the default organizational unit, you must first set another default organiational unit." %}"></a></td>
{% else %}
<td><a class="icon-remove-sign" rel="popup" href="{% url "a2-manager-ou-delete" pk=row.record.pk %}"></a></td>
{% endif %}
{% endif %}
{% endblock %}

View File

@ -1,12 +0,0 @@
{% extends "authentic2/manager/table.html" %}
{% load i18n %}
{% if perms.auth.change_group %}
{% block table.head.last.column %}
<th></th>
{% endblock %}
{% block table.tbody.last.column %}
<td>{% if view.can_change and row.record.is_direct %}<a class="icon-remove-sign js-remove-object" data-confirm="{% blocktrans with name=row.record.name role=active_role.name %}Do you really want to remove role &quot;{{ name }}&quot; from role &quot;{{ object }}&quot;&nbsp;?{% endblocktrans %}" href="#" data-pk-arg="role"></a>{% endif %}</td>
{% endblock %}
{% endif %}