feat: 🎸 CRUDL capabilites for ldap managed-group (#1805)

* feat: 🎸 CRUDL capabilites for ldap managed-group

✅ Closes: ICU-10100

* refactor: 💡 managed-group serializer & remove members tab

* refactor: 💡 show members tab

* fix: 🐛 add type getters in managed group model

* refactor: 💡 fix column name
This commit is contained in:
Lisbet Alvarez authored and GitHub committed 2023-07-28 13:52:04 -07:00
1 parent e5a026ed34
commit d49f3b72a6
19 files changed
+848 -301

No files matched your search

@@ -84,7 +84,7 @@
<Hds::Table
@model={{@model.accounts}}
@columns={{array
(hash label=(t 'resources.account.form.login_name.label'))
(hash label=(t 'form.name.label'))
(hash label=(t 'resources.account.form.email.label'))
(hash label=(t 'resources.account.form.full_name.label'))
(hash label=(t 'resources.account.form.dn.label'))
@@ -23,48 +23,89 @@
<page.body>
{{#if @model.managedGroups}}
<Rose::Table as |table|>
<table.header as |header|>
<header.row as |row|>
<row.headerCell>{{t 'form.name.label'}}</row.headerCell>
<row.headerCell>{{t 'form.description.label'}}</row.headerCell>
<row.headerCell>{{t 'form.type.label'}}</row.headerCell>
<row.headerCell>{{t 'form.id.label'}}</row.headerCell>
</header.row>
</table.header>
<table.body as |body|>
{{#each @model.managedGroups as |managed-group|}}
<body.row as |row|>
<row.headerCell>
{{#if (can 'read model' managed-group)}}
{{#if @model.managedGroups.firstObject.isOIDC}}
<Hds::Table
@model={{@model.managedGroups}}
@columns={{array
(hash label=(t 'form.name.label'))
(hash label=(t 'form.description.label'))
(hash label=(t 'form.type.label'))
(hash label=(t 'form.id.label'))
}}
@valign='middle'
>
<:body as |B|>
<B.Tr>
<B.Td>
{{#if (can 'read model' B.data)}}
<LinkTo
@route='scopes.scope.auth-methods.auth-method.managed-groups.managed-group'
@model={{managed-group.id}}
@model={{B.data.id}}
>
{{managed-group.displayName}}
{{B.data.displayName}}
</LinkTo>
{{else}}
{{managed-group.displayName}}
{{B.data.displayName}}
{{/if}}
</row.headerCell>
<row.cell>{{managed-group.description}}</row.cell>
<row.cell>
<Hds::Badge @text={{managed-group.type}} />
</row.cell>
<row.cell>
</B.Td>
<B.Td>{{B.data.description}}</B.Td>
<B.Td><Hds::Badge @text={{B.data.type}} /></B.Td>
<B.Td>
<Copyable
@text={{managed-group.id}}
@text={{B.data.id}}
@buttonText={{t 'actions.copy-to-clipboard'}}
@acknowledgeText={{t 'states.copied'}}
>
<code>{{managed-group.id}}</code>
<code>{{B.data.id}}</code>
</Copyable>
</row.cell>
</body.row>
{{/each}}
</table.body>
</Rose::Table>
</B.Td>
</B.Tr>
</:body>
</Hds::Table>
{{else}}
<Hds::Table
@model={{@model.managedGroups}}
@columns={{array
(hash label=(t 'form.name.label'))
(hash label=(t 'form.description.label'))
(hash label=(t 'form.type.label'))
(hash label=(t 'form.id.label'))
(hash label=(t 'resources.managed-group.form.group_names.label'))
}}
@valign='middle'
>
<:body as |B|>
<B.Tr>
<B.Td>
{{#if (can 'read model' B.data)}}
<LinkTo
@route='scopes.scope.auth-methods.auth-method.managed-groups.managed-group'
@model={{B.data.id}}
>
{{B.data.displayName}}
</LinkTo>
{{else}}
{{B.data.displayName}}
{{/if}}
</B.Td>
<B.Td>{{B.data.description}}</B.Td>
<B.Td><Hds::Badge @text={{B.data.type}} /></B.Td>
<B.Td>
<Copyable
@text={{B.data.id}}
@buttonText={{t 'actions.copy-to-clipboard'}}
@acknowledgeText={{t 'states.copied'}}
>
<code>{{B.data.id}}</code>
</Copyable>
</B.Td>
<B.Td>
{{truncate-list 'actions.more' B.data.group_names 3}}
</B.Td>
</B.Tr>
</:body>
</Hds::Table>
{{/if}}
{{else}}
<Rose::Layout::Centered>
<Rose::Message
@@ -30,8 +30,11 @@
<page.body>
<Form::ManagedGroup
@model={{@model}}
@edit={{route-action 'edit' @model}}
@submit={{route-action 'save' @model}}
@cancel={{route-action 'cancel' @model}}
@removeItemByIndex={{route-action 'removeItemByIndex' @model}}
@addStringItem={{route-action 'addStringItem' @model}}
/>
</page.body>
@@ -31,53 +31,73 @@
<page.body>
{{#if @model.members}}
<Rose::Table as |table|>
<table.header as |header|>
<header.row as |row|>
<row.headerCell>{{t 'form.name.label'}}</row.headerCell>
<row.headerCell>{{t 'form.issuer.label'}}</row.headerCell>
<row.headerCell>{{t 'form.subject.label'}}</row.headerCell>
<row.headerCell>{{t 'form.email.label'}}</row.headerCell>
<row.headerCell>{{t 'form.full_name.label'}}</row.headerCell>
<row.headerCell>{{t 'form.type.label'}}</row.headerCell>
<row.headerCell>{{t 'form.id.label'}}</row.headerCell>
</header.row>
</table.header>
<table.body as |body|>
{{#each @model.members as |member|}}
<body.row as |row|>
<row.headerCell scope='row'>
{{member.accountName}}
<p>{{member.description}}</p>
</row.headerCell>
<row.cell>
<code>{{member.issuer}}</code>
</row.cell>
<row.cell>
<code>{{member.subject}}</code>
</row.cell>
<row.cell>
<code>{{member.email}}</code>
</row.cell>
<row.cell>
{{member.full_name}}
</row.cell>
<row.cell>
<Hds::Badge @text={{member.type}} />
</row.cell>
<row.cell>
{{#if @model.members.firstObject.isOIDC}}
<Hds::Table
@model={{@model.members}}
@columns={{array
(hash label=(t 'form.name.label'))
(hash label=(t 'form.issuer.label'))
(hash label=(t 'form.subject.label'))
(hash label=(t 'form.email.label'))
(hash label=(t 'form.full_name.label'))
(hash label=(t 'form.type.label'))
(hash label=(t 'form.id.label'))
}}
@valign='middle'
>
<:body as |B|>
<B.Tr>
<B.Td>
{{B.data.accountName}}
<p>{{B.data.description}}</p>
</B.Td>
<B.Td>{{B.data.issuer}}</B.Td>
<B.Td>{{B.data.subject}}</B.Td>
<B.Td>{{B.data.email}}</B.Td>
<B.Td>{{B.data.full_name}}</B.Td>
<B.Td><Hds::Badge @text={{B.data.type}} /></B.Td>
<B.Td>
<Copyable
@text={{member.id}}
@text={{B.data.id}}
@buttonText={{t 'actions.copy-to-clipboard'}}
@acknowledgeText={{t 'states.copied'}}
>
<code>{{member.id}}</code>
<code>{{B.data.id}}</code>
</Copyable>
</row.cell>
</body.row>
{{/each}}
</table.body>
</Rose::Table>
</B.Td>
</B.Tr>
</:body>
</Hds::Table>
{{else}}
<Hds::Table
@model={{@model.members}}
@columns={{array
(hash label=(t 'form.name.label'))
(hash label=(t 'resources.account.form.email.label'))
(hash label=(t 'resources.account.form.full_name.label'))
(hash label=(t 'resources.account.form.dn.label'))
(hash label=(t 'resources.account.form.member_of_groups.label'))
}}
@valign='middle'
>
<:body as |B|>
<B.Tr>
<B.Td>
{{B.data.displayName}}
<p>{{B.data.description}}</p>
</B.Td>
<B.Td>{{B.data.email}}</B.Td>
<B.Td>{{B.data.full_name}}</B.Td>
<B.Td>{{B.data.dn}}</B.Td>
<B.Td>{{truncate-list
'actions.more'
B.data.member_of_groups
3
}}</B.Td>
</B.Tr>
</:body>
</Hds::Table>
{{/if}}
{{else}}
<Rose::Layout::Centered>
<Rose::Message
@@ -12,8 +12,7 @@
<page.header>
<h2>
{{t 'titles.new'}}
{{! TODO: change the icon link }}
<DocLink @doc='account.new' @iconSize='large' />
<DocLink @doc='managed-groups' @iconSize='large' />
</h2>
</page.header>
@@ -22,6 +21,8 @@
@model={{@model}}
@submit={{route-action 'save' @model}}
@cancel={{route-action 'cancel' @model}}
@removeItemByIndex={{route-action 'removeItemByIndex' @model}}
@addStringItem={{route-action 'addStringItem' @model}}
/>
</page.body>