Icu 9226 disable all actions for ldap accounts within users (#1688)
* refactor: 💡 disable all actions for ldap accounts within users ✅ Closes: ICU-9226
This commit is contained in:
1 parent
379f317d8b
commit
8d77bc60b3
8 files changed
+190
-59
No files matched your search
@@ -3,7 +3,7 @@
|
||||
SPDX-License-Identifier: MPL-2.0
|
||||
}}
|
||||
|
||||
{{#if (can 'delete model' @model)}}
|
||||
{{#if (can 'delete account' @model)}}
|
||||
<Rose::Dropdown
|
||||
@text={{t 'actions.manage'}}
|
||||
@dropdownRight={{true}}
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{#if (can 'delete model' @model)}}
|
||||
{{#if (can 'delete auth-method' @model)}}
|
||||
<dropdown.separator />
|
||||
<dropdown.button
|
||||
@style='danger'
|
||||
|
||||
@@ -30,11 +30,13 @@
|
||||
{{#each this.filteredAccounts as |account|}}
|
||||
<body.row as |row|>
|
||||
<row.cell>
|
||||
<form.checkbox
|
||||
@label={{account.id}}
|
||||
@description={{account.description}}
|
||||
@onChange={{fn this.toggleAccount account}}
|
||||
/>
|
||||
<Hds::Form::Checkbox::Field
|
||||
{{on 'change' (fn this.toggleAccount account)}}
|
||||
as |F|
|
||||
>
|
||||
<F.Label>{{account.id}}</F.Label>
|
||||
<F.HelperText>{{account.description}}</F.HelperText>
|
||||
</Hds::Form::Checkbox::Field>
|
||||
</row.cell>
|
||||
<row.cell>{{account.accountName}}</row.cell>
|
||||
<row.cell>
|
||||
|
||||
@@ -4,12 +4,13 @@
|
||||
*/
|
||||
|
||||
import Component from '@glimmer/component';
|
||||
import { computed, action } from '@ember/object';
|
||||
import { action } from '@ember/object';
|
||||
import { A } from '@ember/array';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default class FormUserAddAccountsComponent extends Component {
|
||||
// =properties
|
||||
|
||||
@service can;
|
||||
/**
|
||||
* Array of selected account IDs.
|
||||
* @type {EmberArray}
|
||||
@@ -21,7 +22,6 @@ export default class FormUserAddAccountsComponent extends Component {
|
||||
* @param {[AccountModel]} filteredAccounts
|
||||
* @type {boolean}
|
||||
*/
|
||||
@computed('filteredAccounts.length')
|
||||
get hasAvailableAccounts() {
|
||||
return this.filteredAccounts.length > 0;
|
||||
}
|
||||
@@ -30,12 +30,13 @@ export default class FormUserAddAccountsComponent extends Component {
|
||||
* Accounts not already added to the user.
|
||||
* @type {[AccountModel]}
|
||||
*/
|
||||
@computed('args.{accounts.[],model.account_ids.[]}')
|
||||
get filteredAccounts() {
|
||||
// Get IDs for accounts already added to the current user
|
||||
const alreadyAddedAccountIDs = this.args.model.account_ids;
|
||||
const notAddedAccounts = this.args.accounts.filter(
|
||||
({ id }) => !alreadyAddedAccountIDs.includes(id)
|
||||
(account) =>
|
||||
!alreadyAddedAccountIDs.includes(account.id) &&
|
||||
this.can.can('addAccount user', this.args.model, { account })
|
||||
);
|
||||
return notAddedAccounts;
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ export default class ScopesScopeUsersUserAddAccountsRoute extends Route {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current target, all host catalogs, and all host sets.
|
||||
* @return {{target: TargetModel, hostCatalogs: [HostCatalogModel], hostSets: [HostSetModel]}}
|
||||
* Returns the current user, all auth methods, and all accounts.
|
||||
* @return {{user: UserModel, authMethods: [AuthMethodModel], accounts: [AccountModel]}}
|
||||
*/
|
||||
async model() {
|
||||
const user = this.modelFor('scopes.scope.users.user');
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
{{#each @model.accounts as |account|}}
|
||||
<body.row as |row|>
|
||||
<row.headerCell scope='row'>
|
||||
{{#if (can 'read model' account)}}
|
||||
{{#if (can 'read account' account)}}
|
||||
<LinkTo
|
||||
@route='scopes.scope.auth-methods.auth-method.accounts.account'
|
||||
@model={{account.id}}
|
||||
@@ -95,7 +95,7 @@
|
||||
{{#each @model.accounts as |account|}}
|
||||
<body.row as |row|>
|
||||
<row.headerCell>
|
||||
{{#if (can 'read model' account)}}
|
||||
{{#if (can 'read account' account)}}
|
||||
<LinkTo
|
||||
@route='scopes.scope.auth-methods.auth-method.accounts.account'
|
||||
@model={{account.id}}
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
</Copyable>
|
||||
</row.cell>
|
||||
<row.cell>
|
||||
{{#if (can 'removeAccounts user' @model.user)}}
|
||||
{{#if (can 'removeAccount user' @model.user account=account)}}
|
||||
<Rose::Dropdown
|
||||
@icon='flight-icons/svg/more-horizontal-16'
|
||||
@iconOnly={{true}}
|
||||
|
||||
Reference in new issue
Block a user