open-vault/ui/app/adapters/auth-config/_base.js
Jim Kalafut 1785b1bd00
Replace deprecated terms in AWS Auth (#10997)
* Replace deprecated terms in AWS Auth

This PR is part of an effort to remove non-inclusive language throughout
Vault. The AWS Auth backend uses the "whitelist" and "blacklist" term
extensively, and these are the focus of the PR:

* Add new API endpoints that use the preferred terminology, while
  deprecating the old endpoints. These endpoints offer identical
  functionality and are basically aliases. This is the only functional
  change in the PR except for terms in error messages.
* Replace "whitelist" -> "access list", "blacklist" -> "deny list" in
  variable names, comments, etc.

Note that storage locations were *not* changed at this time, as that is
a more complex process involving versioning that we may tackle in a future
revision. We have reduced the occurrences of non-inclusive language,
however.

Reviewers should be sure to "Ignore Whitespace" in diffs, especially for
the tests, which were basically indented one level as part of looping
over the tests with both the old and new names.
2021-02-25 23:23:34 -08:00

40 lines
1.1 KiB
JavaScript

import ApplicationAdapter from '../application';
export default ApplicationAdapter.extend({
namespace: '/v1/auth',
pathForType(modelType) {
// we want the last part of the path
const type = modelType.split('/').pop();
// TODO: Update endpoints from PR#10997
if (type === 'identity-whitelist' || type === 'roletag-blacklist') {
return `tidy/${type}`;
}
return type;
},
buildURL(modelName, id, snapshot) {
const backendId = id ? id : snapshot.belongsTo('backend').id;
let url = `${this.namespace}/${backendId}/config`;
// aws has a lot more config endpoints
if (modelName.includes('aws')) {
url = `${url}/${this.pathForType(modelName)}`;
}
return url;
},
createRecord(store, type, snapshot) {
const id = snapshot.belongsTo('backend').id;
return this._super(...arguments).then(() => {
return { id };
});
},
updateRecord(store, type, snapshot) {
const id = snapshot.belongsTo('backend').id;
return this._super(...arguments).then(() => {
return { id };
});
},
});