diff --git a/admin/app/components/users/user-overview.gjs b/admin/app/components/users/user-overview.gjs index 8417dce71a5..5202aaee449 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.no' : 'common.words.yes'; + } + _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}} +