From 6e90c03dbef12a379aea4b255f6a6c2664588735 Mon Sep 17 00:00:00 2001 From: Theotime2005 Date: Tue, 4 Feb 2025 16:11:05 +0100 Subject: [PATCH] feat(admin): Add OIDC information --- admin/app/components/users/user-overview.gjs | 16 +++++ .../components/users/user-overview-test.gjs | 71 +++++++++++++++++++ .../components/users/user-overview-test.js | 50 ++++++------- admin/translations/en.json | 3 + admin/translations/fr.json | 3 + 5 files changed, 114 insertions(+), 29 deletions(-) diff --git a/admin/app/components/users/user-overview.gjs b/admin/app/components/users/user-overview.gjs index 8417dce71a5..adfe8fd18f7 100644 --- a/admin/app/components/users/user-overview.gjs +++ b/admin/app/components/users/user-overview.gjs @@ -27,9 +27,11 @@ export default class UserOverview extends Component { @service pixToast; @service references; @service store; + @service oidcIdentityProviders; @tracked displayAnonymizeModal = false; @tracked isEditionMode = false; + @tracked authenticationMethods = []; languages = this.references.availableLanguages; locales = this.references.availableLocales; @@ -39,6 +41,9 @@ export default class UserOverview extends Component { constructor() { super(...arguments); this.form = this.store.createRecord('user-form'); + Promise.resolve(this.args.user.authenticationMethods).then((authenticationMethods) => { + this.authenticationMethods = authenticationMethods; + }); } get externalURL() { @@ -86,6 +91,14 @@ export default class UserOverview extends Component { return this.args.user.username ? null : 'obligatoire'; } + get useOidcAuthentication() { + const oidcProvidersCodes = this.oidcIdentityProviders.list.map((provider) => provider.code); + const userHasThisOidcAuthenticationMethod = this.authenticationMethods.any((authenticationMethod) => + oidcProvidersCodes.includes(authenticationMethod.identityProvider), + ); + return userHasThisOidcAuthenticationMethod ? 'common.words.yes' : 'common.words.no'; + } + _initForm() { this.form.firstName = this.args.user.firstName; this.form.lastName = this.args.user.lastName; @@ -331,6 +344,9 @@ export default class UserOverview extends Component { {{/if}} +
  • + {{t "components.users.user-overview.sso"}} : {{t this.useOidcAuthentication}} +