0003-manager-add-ous-export-29162.patch
src/authentic2/manager/ou_views.py | ||
---|---|---|
1 |
import json |
|
2 | ||
1 | 3 |
from django_rbac.utils import get_ou_model |
2 | 4 |
from django.http import HttpResponseRedirect |
3 | 5 |
from django.contrib import messages |
4 | 6 |
from django.utils.translation import ugettext as _ |
5 | 7 | |
8 |
from authentic2 import data_transfer |
|
9 | ||
6 | 10 |
from . import tables, views, forms |
7 | 11 | |
8 | 12 | |
... | ... | |
13 | 17 |
search_form_class = forms.NameSearchForm |
14 | 18 |
permissions = ['a2_rbac.search_organizationalunit'] |
15 | 19 |
title = _('Organizational units') |
20 |
formats = ['json'] |
|
16 | 21 | |
17 | 22 |
listing = OrganizationalUnitView.as_view() |
18 | 23 | |
... | ... | |
74 | 79 |
**kwargs) |
75 | 80 | |
76 | 81 |
delete = OrganizationalUnitDeleteView.as_view() |
82 | ||
83 | ||
84 |
class RolesExportView(views.ExportMixin, OrganizationalUnitView): |
|
85 |
def get(self, request, *args, **kwargs): |
|
86 |
export = data_transfer.export_site( |
|
87 |
data_transfer.ExportContext( |
|
88 |
ou_qs=self.get_table_data(), |
|
89 |
export_roles=False, |
|
90 |
export_ous=True)) |
|
91 |
return self.export_response(json.dumps(export), 'application/json', 'json') |
|
92 | ||
93 | ||
94 |
export = RolesExportView.as_view() |
src/authentic2/manager/templates/authentic2/manager/ous.html | ||
---|---|---|
26 | 26 |
{% with row_link=1 %} |
27 | 27 |
{% render_table table "authentic2/manager/table.html" %} |
28 | 28 |
{% endwith %} |
29 |
{% include "authentic2/manager/export_include.html" with export_view_name="a2-manager-ou-export" %} |
|
29 | 30 |
{% endblock %} |
src/authentic2/manager/urls.py | ||
---|---|---|
105 | 105 |
name='a2-manager-ou-edit'), |
106 | 106 |
url(r'^organizational-units/(?P<pk>\d+)/delete/$', ou_views.delete, |
107 | 107 |
name='a2-manager-ou-delete'), |
108 |
url(r'^organizational-units/export/(?P<format>json)/$', |
|
109 |
ou_views.export, |
|
110 |
name='a2-manager-ou-export'), |
|
108 | 111 | |
109 | 112 |
# Services |
110 | 113 |
url(r'^services/$', service_views.listing, |
111 |
- |