idp_oidc: deactivate service authz page according to setting (#45649)

This commit is contained in:
Paul Marillonnet 2020-08-04 11:48:20 +02:00
parent 4baa839294
commit 7fecf1140e
2 changed files with 6 additions and 1 deletions

View File

@ -1302,4 +1302,5 @@ class AuthorizedOauthServicesView(TemplateView):
return HttpResponseRedirect(reverse('authorized-oauth-services'))
authorized_oauth_services = AuthorizedOauthServicesView.as_view()
authorized_oauth_services = decorators.setting_enabled(
'A2_PROFILE_CAN_MANAGE_SERVICE_AUTHORIZATIONS')(AuthorizedOauthServicesView.as_view())

View File

@ -250,6 +250,10 @@ def test_account_view(app, simple_user, settings):
settings.A2_PROFILE_CAN_CHANGE_EMAIL = False
settings.A2_PROFILE_CAN_MANAGE_SERVICE_AUTHORIZATIONS = False
settings.A2_REGISTRATION_CAN_DELETE_ACCOUNT = False
# check that service authz page is unknown due to setting deactivation
url = reverse('authorized-oauth-services')
response = app.get(url, status=404)
# only profile edit link is available on main page
url = reverse('account_management')
response = app.get(url, status=200)
assert [x['href'] for x in response.html.find('div', {'id': 'a2-profile'}).find_all('a')] == [