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/addons/api/mirage/generated/factories/user.js b/addons/api/mirage/generated/factories/user.js index c8004c988..12b40a6e1 100644 --- a/addons/api/mirage/generated/factories/user.js +++ b/addons/api/mirage/generated/factories/user.js @@ -1,5 +1,5 @@ import { Factory } from 'ember-cli-mirage'; -import { random, date, datatype } from 'faker'; +import { random, date, datatype, internet } from 'faker'; /** * GeneratedUserModelFactory @@ -11,4 +11,5 @@ export default Factory.extend({ created_time: () => date.recent(), updated_time: () => date.recent(), disabled: () => datatype.boolean(), + email: () => internet.email().toLowerCase(), }); diff --git a/addons/rose/addon/styles/rose/components/dropdown/_dropdown.scss b/addons/rose/addon/styles/rose/components/dropdown/_dropdown.scss index 96717ebc1..b8f3450f4 100644 --- a/addons/rose/addon/styles/rose/components/dropdown/_dropdown.scss +++ b/addons/rose/addon/styles/rose/components/dropdown/_dropdown.scss @@ -27,6 +27,7 @@ $chevronGrey: url("data:image/svg+xml;utf-8, {{t 'form.name.label'}} + {{t 'form.id.label'}} + {{t 'form.description.label'}} {{#each this.availableUsers as |user|}} - + - - {{user.name}} + {{#if user.accountName}} + {{! + The following is a formatting hack since we don't have a great + way to manage micro-whitespace or alignment among separate + components without resorting to heavy-handed grids + or contextualization. This is a one-off. + }} +
+        + {{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..af5e73e3d 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,33 @@ - {{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}} + {{! + The following is a formatting hack since we don't have a great + way to manage micro-whitespace or alignment among separate + components without resorting to heavy-handed grids + or contextualization. This is a one-off. + }} +
+        + {{principal.accountName}} + {{/if}} + + {{principal.id}} {{t (concat @@ -40,6 +51,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 b46db0f97..9df657c32 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/sessions/index.hbs b/ui/admin/app/templates/scopes/scope/sessions/index.hbs index bb07fabf9..297c68a70 100644 --- a/ui/admin/app/templates/scopes/scope/sessions/index.hbs +++ b/ui/admin/app/templates/scopes/scope/sessions/index.hbs @@ -47,7 +47,13 @@ {{sessionAggregate.session.id}}
- {{sessionAggregate.user.displayName}} + + {{sessionAggregate.user.id}} + {{#if sessionAggregate.user.accountName}} +
{{sessionAggregate.user.accountName}} + {{/if}} +
{{sessionAggregate.target.displayName}}