diff --git a/apimanager/users/templates/users/detail.html b/apimanager/users/templates/users/detail.html index eeb0f146..a5d6c06c 100644 --- a/apimanager/users/templates/users/detail.html +++ b/apimanager/users/templates/users/detail.html @@ -119,6 +119,7 @@

{% trans "Entitlements" %}

+

{% trans "Non Personal User Attributes" %}

@@ -137,7 +138,6 @@

{% trans "Non Personal User Attributes" %}

{{ attribute.value }} {{ attribute.insert_date }} - {# SuperAdmin has no entitlement_id! #} {% if attribute.user_attribute_id %}
{% csrf_token %} @@ -152,6 +152,26 @@

{% trans "Non Personal User Attributes" %}

+ +

{% trans "Accounts Access" %}

+
+ + + + + + + + {% for account in accounts_access.accounts %} + + + + + + {% endfor %} + +
{% trans "Bank ID" %}{% trans "Account ID" %}{% trans "View ID" %}
{{ account.bank_id }}{{ account.account_id }}{{ account.view_id }}
+
{% endif %} diff --git a/apimanager/users/views.py b/apimanager/users/views.py index f0c540fa..d140b718 100644 --- a/apimanager/users/views.py +++ b/apimanager/users/views.py @@ -189,10 +189,20 @@ def get_context_data(self, **kwargs): try: urlpath = '/users/{}/non-personal/attributes'.format(self.kwargs['user_id']) non_personal_user_attributes = self.api.get(urlpath, settings.API_VERSION["v510"]) - if 'code' in user and user['code']>=400: - messages.error(self.request, user['message']) - else: - context['form'].fields['user_id'].initial = user['user_id'] + if 'code' in non_personal_user_attributes and non_personal_user_attributes['code']>=400: + messages.error(self.request, non_personal_user_attributes['message']) + except APIError as err: + messages.error(self.request, err) + except Exception as err: + messages.error(self.request, err) + + accounts_access = {} + try: + urlpath = '/users/{}/account-access'.format(self.kwargs['user_id']) + accounts_access = self.api.get(urlpath, settings.API_VERSION["v510"]) + print(accounts_access) + if 'code' in accounts_access and accounts_access['code']>=400: + messages.error(self.request, accounts_access['message']) except APIError as err: messages.error(self.request, err) except Exception as err: @@ -201,6 +211,7 @@ def get_context_data(self, **kwargs): context.update({ 'apiuser': user, # 'user' is logged-in user in template context 'attributes': non_personal_user_attributes, + 'accounts_access': accounts_access, }) return context