manager: move and rename consents button (#47266)

This commit is contained in:
Nicolas Roche 2020-10-06 10:28:34 +02:00
parent bb428414e8
commit 9a07dc2a18
2 changed files with 19 additions and 10 deletions

View File

@ -4,6 +4,8 @@
{% block appbar %}
{{ block.super }}
<span class="actions">
<a class="extra-actions-menu-opener"></a>
{% if view.can_delete %}
<a rel="popup" href="{% url "a2-manager-user-delete" pk=object.pk %}">{% trans "Delete" %}</a>
{% else %}
@ -16,9 +18,11 @@
<a class="disabled" title="{% trans "You do not have the rights to edit this user." %}" href="#">{% trans "Edit" %}</a>
{% endif %}
{% if view.is_oidc_services %}
<a href="{% url "a2-manager-user-authorizations" pk=object.pk %}">{% trans "Authorizations" %}</a>
{% endif %}
<ul class="extra-actions-menu">
{% if view.is_oidc_services %}
<li><a href="{% url "a2-manager-user-authorizations" pk=object.pk %}">{% trans "Consents" %}</a></li>
{% endif %}
</ul>
</span>
{% endblock %}
@ -75,7 +79,7 @@
<ul>
{% for ou, ou_roles in roles_by_ou.items %}
{% if have_roles_on_multiple_ou %}
<li>{% if ou %}{{ ou }}{% else %}{% trans "All organizational units" %}{% endif %}
<li>{% if ou %}{{ ou }}{% else %}{% trans "All organizational units" %}{% endif %}
<ul>
{% endif %}
{% for role in ou_roles %}

View File

@ -852,7 +852,8 @@ def test_manager_user_authorizations(app, superuser, simple_user):
resp = login(app, superuser)
resp = app.get(user_detail_url, status=200)
assert not resp.html.find('div', {'id': 'appbar'}).find_all('a', {'href': user_authorizations_url})
assert user_authorizations_url not in [
x['href'] for x in resp.html.find('ul', {'class': 'extra-actions-menu'}).find_all('a')]
# add a service consent to simple_user
oidc_client = OIDCClient.objects.create(
@ -862,7 +863,8 @@ def test_manager_user_authorizations(app, superuser, simple_user):
redirect_uris='https://example.com/')
resp = app.get(user_detail_url, status=200)
assert resp.html.find('div', {'id': 'appbar'}).find_all('a', {'href': user_authorizations_url})
assert user_authorizations_url in [
x['href'] for x in resp.html.find('ul', {'class': 'extra-actions-menu'}).find_all('a')]
auth = OIDCAuthorization.objects.create(
client=oidc_client, user=simple_user, scopes='openid',
@ -902,8 +904,9 @@ def test_manager_user_authorizations(app, superuser, simple_user):
# user2 can see auth authorizations
resp = login(app, user2)
resp = app.get(user_detail_url, status=200)
assert resp.html.find('div', {'id': 'appbar'}).find_all('a', {'href': user_authorizations_url})
resp = resp.click('Authorizations')
assert user_authorizations_url in [
x['href'] for x in resp.html.find('ul', {'class': 'extra-actions-menu'}).find_all('a')]
resp = resp.click('Consents')
assert resp.html.find('h2').text == 'Consent Management'
assert resp.html.find('td', {'class': 'remove-icon-column'}).a['class'] == ['disabled']
# cannot click it's JS :/
@ -915,8 +918,10 @@ def test_manager_user_authorizations(app, superuser, simple_user):
# user3 can remove auth authorizations
resp = login(app, user3)
resp = app.get(user_detail_url, status=200)
assert resp.html.find('div', {'id': 'appbar'}).find_all('a', {'href': user_authorizations_url})
resp = resp.click('Authorizations')
assert user_authorizations_url in [
x['href'] for x in resp.html.find('ul', {'class': 'extra-actions-menu'}).find_all('a')]
resp = resp.click('Consents')
resp = app.get(user_authorizations_url, status=200)
assert resp.html.find('h2').text == 'Consent Management'
assert resp.html.find('td', {'class': 'remove-icon-column'}).a['class'] == ['js-remove-object']
# cannot click it's JS :/