diff --git a/addons/api/addon/models/user.js b/addons/api/addon/models/user.js index 49fe64520..452a64889 100644 --- a/addons/api/addon/models/user.js +++ b/addons/api/addon/models/user.js @@ -1,5 +1,6 @@ import GeneratedUserModel from '../generated/models/user'; import { attr } from '@ember-data/model'; +import { computed } from '@ember/object'; import { A } from '@ember/array'; export default class UserModel extends GeneratedUserModel { @@ -16,6 +17,35 @@ export default class UserModel extends GeneratedUserModel { }) account_ids; + /** + * Represents the user's primary account email, if any. + * @type {string} + */ + @attr('string', { readOnly: true }) email; + + /** + * Represents the user's primary account full_name, if any. + * @type {string} + */ + @attr('string', { readOnly: true }) full_name; + + /** + * Represents the user's primary account login_name, if any. + * @type {string} + */ + @attr('string', { readOnly: true }) login_name; + + /** + * Convenience for getting a reasonable string that names the account. + * There are many options, so we fallback in order of precedence. + * @type {string} + */ + @computed('email,full_name,login_name,displayName') + get accountName() { + const { email, full_name, login_name } = this; + return email || full_name || login_name; + } + // =methods /** diff --git a/ui/admin/app/components/form/group/add-members/index.hbs b/ui/admin/app/components/form/group/add-members/index.hbs index c9d68523c..b5e7cab8c 100644 --- a/ui/admin/app/components/form/group/add-members/index.hbs +++ b/ui/admin/app/components/form/group/add-members/index.hbs @@ -16,21 +16,25 @@ - {{t 'form.id.label'}} {{t 'form.name.label'}} + {{t 'form.id.label'}} + {{t 'form.description.label'}} {{#each this.availableUsers as |user|}} - + - - {{user.name}} + {{#if user.accountName}} +
{{user.accountName}} + {{/if}} + + {{user.id}} + {{user.description}}
{{/each}}
diff --git a/ui/admin/app/components/form/role/add-principals/index.hbs b/ui/admin/app/components/form/role/add-principals/index.hbs index 267a44584..10bb5bb05 100644 --- a/ui/admin/app/components/form/role/add-principals/index.hbs +++ b/ui/admin/app/components/form/role/add-principals/index.hbs @@ -16,22 +16,25 @@ - {{t 'form.id.label'}} {{t 'form.name.label'}} + {{t 'form.id.label'}} {{t 'form.type.label'}} + {{t 'form.description.label'}} {{#each this.filteredPrincipals as |principal|}} - + - - {{principal.name}} + {{#if principal.accountName}} +
{{principal.accountName}} + {{/if}} + + {{principal.id}} {{t (concat @@ -40,6 +43,7 @@ ) }} + {{principal.description}}
{{/each}}
diff --git a/ui/admin/app/templates/scopes/scope/groups/group/members.hbs b/ui/admin/app/templates/scopes/scope/groups/group/members.hbs index 07dfe8014..d40856f1d 100644 --- a/ui/admin/app/templates/scopes/scope/groups/group/members.hbs +++ b/ui/admin/app/templates/scopes/scope/groups/group/members.hbs @@ -15,6 +15,9 @@ {{member.displayName}} + {{#if member.accountName}} +
{{member.accountName}} + {{/if}}
{{principal.model.displayName}} + {{#if principal.model.accountName}} +
{{principal.model.accountName}} + {{/if}}
{{t (concat 'resources.role.principal.types.' principal.type)}} diff --git a/ui/admin/app/templates/scopes/scope/users/index.hbs b/ui/admin/app/templates/scopes/scope/users/index.hbs index 826e84805..2c78ceb2d 100644 --- a/ui/admin/app/templates/scopes/scope/users/index.hbs +++ b/ui/admin/app/templates/scopes/scope/users/index.hbs @@ -46,6 +46,9 @@ {{else}} {{user.displayName}} {{/if}} + {{#if user.accountName}} +
{{user.accountName}} + {{/if}}

{{user.description}}