refactor: 💡 removed vault_ldap_feature flag (#3045)
This commit is contained in:
1 parent
136baf8260
commit
d8744e81bc
5 files changed
+35
-93
No files matched your search
@@ -7,7 +7,6 @@ import Component from '@glimmer/component';
|
||||
import {
|
||||
TYPES_CREDENTIAL_LIBRARY,
|
||||
TYPE_CREDENTIAL_LIBRARY_VAULT_SSH_CERTIFICATE,
|
||||
TYPE_CREDENTIAL_LIBRARY_VAULT_LDAP,
|
||||
} from 'api/models/credential-library';
|
||||
import { service } from '@ember/service';
|
||||
|
||||
@@ -22,18 +21,10 @@ export default class FormCredentialLibraryRadioComponent extends Component {
|
||||
get credentialTypes() {
|
||||
let types = [...TYPES_CREDENTIAL_LIBRARY];
|
||||
|
||||
if (!this.features.isEnabled('ssh-target')) {
|
||||
types = types.filter(
|
||||
(type) => type !== TYPE_CREDENTIAL_LIBRARY_VAULT_SSH_CERTIFICATE,
|
||||
);
|
||||
}
|
||||
|
||||
if (!this.features.isEnabled('vault-ldap-credential')) {
|
||||
types = types.filter(
|
||||
(type) => type !== TYPE_CREDENTIAL_LIBRARY_VAULT_LDAP,
|
||||
);
|
||||
}
|
||||
|
||||
return types;
|
||||
return this.features.isEnabled('ssh-target')
|
||||
? types
|
||||
: types.filter(
|
||||
(type) => type !== TYPE_CREDENTIAL_LIBRARY_VAULT_SSH_CERTIFICATE,
|
||||
);
|
||||
}
|
||||
}
|
||||
+30
-37
@@ -40,45 +40,38 @@
|
||||
@valign='middle'
|
||||
>
|
||||
<:body as |B|>
|
||||
{{#if
|
||||
(or
|
||||
(not-eq B.data.type 'vault-ldap')
|
||||
(feature-flag 'vault-ldap-credential')
|
||||
)
|
||||
}}
|
||||
<B.Tr>
|
||||
<B.Td>
|
||||
{{#if (can 'read credential-library' B.data)}}
|
||||
<LinkTo
|
||||
@route='scopes.scope.credential-stores.credential-store.credential-libraries.credential-library'
|
||||
@model={{B.data.id}}
|
||||
>
|
||||
{{B.data.displayName}}
|
||||
</LinkTo>
|
||||
{{else}}
|
||||
<Hds::Text::Body @tag='p'>
|
||||
{{B.data.displayName}}
|
||||
</Hds::Text::Body>
|
||||
{{/if}}
|
||||
<B.Tr>
|
||||
<B.Td>
|
||||
{{#if (can 'read credential-library' B.data)}}
|
||||
<LinkTo
|
||||
@route='scopes.scope.credential-stores.credential-store.credential-libraries.credential-library'
|
||||
@model={{B.data.id}}
|
||||
>
|
||||
{{B.data.displayName}}
|
||||
</LinkTo>
|
||||
{{else}}
|
||||
<Hds::Text::Body @tag='p'>
|
||||
{{B.data.description}}
|
||||
{{B.data.displayName}}
|
||||
</Hds::Text::Body>
|
||||
</B.Td>
|
||||
<B.Td>
|
||||
<Hds::Badge
|
||||
@text={{t
|
||||
(concat 'resources.credential-library.types.' B.data.type)
|
||||
}}
|
||||
/>
|
||||
</B.Td>
|
||||
<B.Td>
|
||||
<Hds::Copy::Snippet
|
||||
@textToCopy={{B.data.id}}
|
||||
@color='secondary'
|
||||
/>
|
||||
</B.Td>
|
||||
</B.Tr>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
<Hds::Text::Body @tag='p'>
|
||||
{{B.data.description}}
|
||||
</Hds::Text::Body>
|
||||
</B.Td>
|
||||
<B.Td>
|
||||
<Hds::Badge
|
||||
@text={{t
|
||||
(concat 'resources.credential-library.types.' B.data.type)
|
||||
}}
|
||||
/>
|
||||
</B.Td>
|
||||
<B.Td>
|
||||
<Hds::Copy::Snippet
|
||||
@textToCopy={{B.data.id}}
|
||||
@color='secondary'
|
||||
/>
|
||||
</B.Td>
|
||||
</B.Tr>
|
||||
</:body>
|
||||
</Hds::Table>
|
||||
{{else}}
|
||||
|
||||
@@ -28,8 +28,6 @@ const baseEdition = {
|
||||
'ldap-auth-methods': false,
|
||||
'worker-filter': false,
|
||||
'worker-filter-hcp': false,
|
||||
// TODO: Remove this flag when Vault-ldap credential library is supported
|
||||
'vault-ldap-credential': false,
|
||||
};
|
||||
// Editions maps edition keys to their associated featuresets.
|
||||
const featureEditions = {};
|
||||
|
||||
@@ -444,8 +444,6 @@ module('Acceptance | credential-libraries | create', function (hooks) {
|
||||
},
|
||||
});
|
||||
|
||||
featuresService.enable('vault-ldap-credential');
|
||||
|
||||
await visit(urls.newCredentialLibrary);
|
||||
|
||||
await click(selectors.TYPE_VAULT_LDAP);
|
||||
@@ -475,22 +473,6 @@ module('Acceptance | credential-libraries | create', function (hooks) {
|
||||
);
|
||||
});
|
||||
|
||||
test('cannot select vault ldap when feature is disabled', async function (assert) {
|
||||
setRunOptions({
|
||||
rules: {
|
||||
'color-contrast': {
|
||||
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-09-04
|
||||
enabled: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
await visit(urls.newCredentialLibrary);
|
||||
|
||||
assert.false(featuresService.isEnabled('vault-ldap-credential'));
|
||||
assert.dom(selectors.TYPE_VAULT_LDAP).doesNotExist();
|
||||
});
|
||||
|
||||
test('default `vault-generic` credential library is selected when `ssh-target` feature is not enabled and user manually sets `type` in the query params', async function (assert) {
|
||||
setRunOptions({
|
||||
rules: {
|
||||
@@ -501,8 +483,6 @@ module('Acceptance | credential-libraries | create', function (hooks) {
|
||||
},
|
||||
});
|
||||
|
||||
featuresService.enable('vault-ldap-credential');
|
||||
|
||||
await visit(`${urls.newCredentialLibrary}?type=vault-ssh-certificate`);
|
||||
|
||||
assert.dom(selectors.TYPE_VAULT_SSH_CERT).isNotVisible();
|
||||
|
||||
@@ -15,7 +15,6 @@ module('Acceptance | credential-libraries | list', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
let featuresService;
|
||||
const instances = {
|
||||
scopes: {
|
||||
org: null,
|
||||
@@ -59,7 +58,6 @@ module('Acceptance | credential-libraries | list', function (hooks) {
|
||||
urls.credentialStore = `${urls.credentialStores}/${instances.credentialStore.id}`;
|
||||
urls.credentialLibraries = `${urls.credentialStore}/credential-libraries`;
|
||||
urls.vaultLDAPCredentialLibrary = `${urls.credentialLibraries}/${instances.vaultLDAPCredentialLibrary.id}`;
|
||||
featuresService = this.owner.lookup('service:features');
|
||||
});
|
||||
|
||||
test('Users can navigate to credential libraries with proper authorization', async function (assert) {
|
||||
@@ -108,28 +106,10 @@ module('Acceptance | credential-libraries | list', function (hooks) {
|
||||
},
|
||||
});
|
||||
|
||||
featuresService.enable('vault-ldap-credential');
|
||||
await visit(urls.credentialLibraries);
|
||||
|
||||
assert
|
||||
.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.vaultLDAPCredentialLibrary))
|
||||
.isVisible();
|
||||
});
|
||||
|
||||
test('User cannot navigate to vault ldap credential library details when feature is not enabled', async function (assert) {
|
||||
setRunOptions({
|
||||
rules: {
|
||||
'color-contrast': {
|
||||
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-09-04
|
||||
enabled: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
await visit(urls.credentialLibraries);
|
||||
|
||||
assert
|
||||
.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.vaultLDAPCredentialLibrary))
|
||||
.doesNotExist();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user