0001-manager-remind-OU-in-user-consents-breadcrumb-47238.patch
src/authentic2/manager/templates/authentic2/manager/user_authorizations.html | ||
---|---|---|
5 | 5 | |
6 | 6 |
{% block appbar %} |
7 | 7 |
{{ block.super }} |
8 | 8 |
{% endblock %} |
9 | 9 | |
10 | 10 |
{% block breadcrumb %} |
11 | 11 |
{{ block.super }} |
12 | 12 |
<a href="{% url 'a2-manager-users' %}">{% trans 'Users' %}</a> |
13 |
{% if multiple_ou and object.ou %} |
|
14 |
<a href="../?search-ou={{ object.ou.pk }}">{{ object.ou }}</a> |
|
15 |
{% endif %} |
|
13 | 16 |
<a href="{% url 'a2-manager-user-detail' pk=object.pk %}">{{ object.get_full_name }}</a> |
14 | 17 |
<a href="#">{% trans "Consent Management" context "manager" %}</a> |
15 | 18 |
{% endblock %} |
16 | 19 | |
17 | 20 |
{% block sidebar %} |
18 | 21 |
<aside id="sidebar"> |
19 | 22 |
</aside> |
20 | 23 |
{% endblock %} |
src/authentic2/manager/views.py | ||
---|---|---|
416 | 416 |
def get_table(self, **kwargs): |
417 | 417 |
table = super(TableHookMixin, self).get_table(**kwargs) |
418 | 418 |
import copy |
419 | 419 |
table = copy.deepcopy(table) |
420 | 420 |
hooks.call_hooks('manager_modify_table', self, table) |
421 | 421 |
return table |
422 | 422 | |
423 | 423 | |
424 |
class BaseTableView(TitleMixin, TableHookMixin, FormatsContextData, ModelNameMixin, PermissionMixin,
|
|
425 |
SearchFormMixin, FilterQuerysetByPermMixin, TableQuerysetMixin, |
|
424 |
class BaseTableView(MultipleOUMixin, TitleMixin, TableHookMixin, FormatsContextData, ModelNameMixin,
|
|
425 |
PermissionMixin, SearchFormMixin, FilterQuerysetByPermMixin, TableQuerysetMixin,
|
|
426 | 426 |
SingleTableView): |
427 | 427 |
'''Base class for views showing a table of objects''' |
428 | 428 |
pass |
429 | 429 | |
430 | 430 | |
431 | 431 |
class SubTableViewMixin(TableHookMixin, FormatsContextData, ModelNameMixin, PermissionMixin, |
432 | 432 |
SearchFormMixin, FilterTableQuerysetByPermMixin, |
433 | 433 |
TableQuerysetMixin, SingleObjectMixin, |
tests/test_user_manager.py | ||
---|---|---|
915 | 915 |
# cannot click it's JS :/ |
916 | 916 |
token = str(resp.context['csrf_token']) |
917 | 917 |
params = {'authorization': auth.pk, 'csrfmiddlewaretoken': token} |
918 | 918 |
resp = app.post(user_authorizations_url, params=params, status=302) |
919 | 919 |
assert OIDCAuthorization.objects.count() == 0 |
920 | 920 |
resp = resp.follow() |
921 | 921 |
assert resp.html.find('td').text == \ |
922 | 922 |
'This user has not granted profile data access to any service yet.' |
923 | ||
924 |
def test_manager_user_authorizations_breadcrumb(app, superuser, simple_user): |
|
925 |
resp = login(app, superuser) |
|
926 |
user_authorizations_url = reverse( |
|
927 |
'a2-manager-user-authorizations', kwargs={'pk': simple_user.id}) |
|
928 |
resp = app.get(user_authorizations_url, status=200) |
|
929 |
assert [x.text for x in resp.html.find('span', {'id': 'breadcrumb'}).find_all('a')] == [ |
|
930 |
'Homepage', 'Administration', 'Users', 'Default organizational unit', |
|
931 |
'Jôhn Dôe', 'Consent Management'] |
|
932 |
user_authorizations_url = reverse( |
|
933 |
'a2-manager-user-authorizations', kwargs={'pk': superuser.id}) |
|
934 |
resp = app.get(user_authorizations_url, status=200) |
|
935 |
assert [x.text for x in resp.html.find('span', {'id': 'breadcrumb'}).find_all('a')] == [ |
|
936 |
'Homepage', 'Administration', 'Users', |
|
937 |
'super user', 'Consent Management'] |
|
923 |
- |