Merge pull request #3 from hashicorp/oss/merge-main-f3dbd7cdab52fc382af402f4192ebbe0ab2985ae
[main] OSS to ENT merge of (f3dbd7c)
This commit is contained in:
commit
3a9d629b9d
6 files changed
+67
-15
No files matched your search
@@ -155,7 +155,6 @@ export default class RoleModel extends GeneratedRoleModel {
|
||||
// return a promise resolving to an empty array
|
||||
return resolve([]);
|
||||
}
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
{{#if this.isManagedGroup}}
|
||||
<LinkTo
|
||||
@route={{this.link}}
|
||||
@models={{array @model.auth_method_id @model.id}}
|
||||
>
|
||||
{{@model.displayName}}
|
||||
</LinkTo>
|
||||
{{else}}
|
||||
<LinkTo @route={{this.link}} @model={{@model.id}}>
|
||||
{{@model.displayName}}
|
||||
</LinkTo>
|
||||
{{/if}}
|
||||
@@ -0,0 +1,26 @@
|
||||
import Component from '@glimmer/component';
|
||||
|
||||
const principalTypeRoutes = {
|
||||
user: 'scopes.scope.users.user',
|
||||
group: 'scopes.scope.groups.group',
|
||||
'managed-group':
|
||||
'scopes.scope.auth-methods.auth-method.managed-groups.managed-group',
|
||||
};
|
||||
|
||||
export default class LinkToPrincipalComponent extends Component {
|
||||
/**
|
||||
* return true if its a managed group model
|
||||
* @type {boolean}
|
||||
*/
|
||||
get isManagedGroup() {
|
||||
return this.args.model.constructor.modelName === 'managed-group';
|
||||
}
|
||||
|
||||
/**
|
||||
* return route based on principal type
|
||||
* @type {string}
|
||||
*/
|
||||
get link() {
|
||||
return principalTypeRoutes[this.args.model.constructor.modelName];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<Hds::Badge
|
||||
@icon={{this.icon}}
|
||||
@text={{t
|
||||
(concat 'resources.role.principal.types.' @model.constructor.modelName)
|
||||
}}
|
||||
/>
|
||||
@@ -0,0 +1,17 @@
|
||||
import Component from '@glimmer/component';
|
||||
|
||||
const principalTypes = {
|
||||
user: 'user',
|
||||
group: 'folder-users',
|
||||
'managed-group': 'cloud-lock',
|
||||
};
|
||||
export default class PrincipalTypeBadgeComponent extends Component {
|
||||
/**
|
||||
* Display icons based on the pricipal type
|
||||
* @type {string}
|
||||
*/
|
||||
|
||||
get icon() {
|
||||
return principalTypes[this.args.model.constructor.modelName];
|
||||
}
|
||||
}
|
||||
@@ -46,7 +46,11 @@
|
||||
{{#each @model.principals as |principal|}}
|
||||
<body.row as |row|>
|
||||
<row.headerCell>
|
||||
{{principal.displayName}}
|
||||
{{#if (can 'readPrincipal role' principal)}}
|
||||
<LinkToPrincipal @model={{principal}} />
|
||||
{{else}}
|
||||
{{principal.displayName}}
|
||||
{{/if}}
|
||||
{{#if principal.accountName}}
|
||||
<br /><Hds::Badge @text={{principal.accountName}} />
|
||||
{{/if}}
|
||||
@@ -61,19 +65,7 @@
|
||||
</Copyable>
|
||||
</row.cell>
|
||||
<row.cell>
|
||||
<Hds::Badge
|
||||
@icon={{if
|
||||
(eq principal.constructor.modelName 'group')
|
||||
'folder-users'
|
||||
'user'
|
||||
}}
|
||||
@text={{t
|
||||
(concat
|
||||
'resources.role.principal.types.'
|
||||
principal.constructor.modelName
|
||||
)
|
||||
}}
|
||||
/>
|
||||
<PrincipalTypeBadge @model={{principal}} />
|
||||
</row.cell>
|
||||
<row.cell>
|
||||
<ScopeBadge @scope={{principal.scopeModel}} />
|
||||
|
||||
Reference in new issue
Block a user