diff --git a/src/internal/modules/internal-search/controller.js b/src/internal/modules/internal-search/controller.js index 9171f1b15..dca29d731 100644 --- a/src/internal/modules/internal-search/controller.js +++ b/src/internal/modules/internal-search/controller.js @@ -14,6 +14,8 @@ const { setPermissionsForm, setPermissionsSchema, permissionsChoices } = require const { hasScope } = require('../../lib/permissions') const { scope } = require('internal/lib/constants') +const config = require('../../config.js') + /** * Renders a search form and results pages for internal users to search * for licences, licence holders, users, and returns @@ -99,7 +101,8 @@ const getUserStatus = async (request, h, formFromPost) => { userStatus, form: formFromPost || await getPermissionsFormData(request), deleteAccountLink: `/account/delete-account/${userId}`, - unlinkLicencePathTail: `unlink-licence?userId=${userId}` + unlinkLicencePathTail: `unlink-licence?userId=${userId}`, + enableSystemLicenceView: config.featureToggles.enableSystemLicenceView } return h.view('nunjucks/internal-search/user-status', view) diff --git a/src/internal/views/nunjucks/internal-search/macros/company-licences.njk b/src/internal/views/nunjucks/internal-search/macros/company-licences.njk index e66855ebb..1adcf09dc 100644 --- a/src/internal/views/nunjucks/internal-search/macros/company-licences.njk +++ b/src/internal/views/nunjucks/internal-search/macros/company-licences.njk @@ -1,6 +1,6 @@ {% from "details-when.njk" import detailsWhen %} -{% macro companyLicences(licences, userCanUnlinkLicences, unlinkLicencePathTail) %} +{% macro companyLicences(licences, userCanUnlinkLicences, unlinkLicencePathTail, enableSystemLicenceView) %} {% if licences.length > 0 %}

{{ licences | length }} {{ 'licence' | pluralize(licences) }} @@ -18,8 +18,8 @@ {% for licence in licences %} - {% if featureFlags.enableSystemLicenceView == true %} - {{ licence.licenceRef }} + {% if enableSystemLicenceView == true %} + {{ licence.licenceRef }} {% else %} {{ licence.licenceRef }} {% endif %} diff --git a/src/internal/views/nunjucks/internal-search/macros/user-companies.njk b/src/internal/views/nunjucks/internal-search/macros/user-companies.njk index 9ca798dad..2f1ce5eca 100644 --- a/src/internal/views/nunjucks/internal-search/macros/user-companies.njk +++ b/src/internal/views/nunjucks/internal-search/macros/user-companies.njk @@ -1,7 +1,7 @@ {% from "./company-verifications.njk" import companyVerifications %} {% from "./company-licences.njk" import companyLicences %} -{% macro userCompanies(companies, user, unlinkLicencePathTail) %} +{% macro userCompanies(companies, user, unlinkLicencePathTail, enableSystemLicenceView) %} {% for company in companies %}

{{ company.name }}

@@ -11,6 +11,6 @@ {{ companyVerifications(company.outstandingVerifications) }} {% set userCanUnlinkLicences = (('unlink_licences' in user.scope) and ('primary_user' in company.userRoles)) %} - {{ companyLicences(company.registeredLicences, userCanUnlinkLicences, unlinkLicencePathTail) }} + {{ companyLicences(company.registeredLicences, userCanUnlinkLicences, unlinkLicencePathTail, enableSystemLicenceView) }} {% endfor %} {% endmacro %} diff --git a/src/internal/views/nunjucks/internal-search/user-status.njk b/src/internal/views/nunjucks/internal-search/user-status.njk index bcf21ba56..fa0dfca4e 100644 --- a/src/internal/views/nunjucks/internal-search/user-status.njk +++ b/src/internal/views/nunjucks/internal-search/user-status.njk @@ -19,7 +19,7 @@ {% endif %} {% else %} {% if userStatus.licenceCount %} - {{ userCompanies(userStatus.companies, user, unlinkLicencePathTail) }} + {{ userCompanies(userStatus.companies, user, unlinkLicencePathTail, enableSystemLicenceView) }} {% else %}

This user does not have any licences linked to their account