mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-19 05:31:10 +02:00
* wip tests * fix links * Revert "wip tests" This reverts commit aed9bb9b8fffb1b4d52d9c27644033ff3d983fff. * wip tests * add policy generator * add workflow tests for key * change apostrophe -___- * fix workflow tests * add update to key form tests * fix capability check for read * finish tests * fix flash messages; * rename policy generator file, update tests
53 lines
1.3 KiB
JavaScript
53 lines
1.3 KiB
JavaScript
import { singularize } from 'ember-inflector';
|
|
|
|
export const adminPolicy = (mountPath) => {
|
|
return `
|
|
path "${mountPath}/*" {
|
|
capabilities = ["create", "read", "update", "delete", "list"]
|
|
},
|
|
`;
|
|
};
|
|
|
|
// keys require singularized paths for GET
|
|
export const readerPolicy = (mountPath, resource) => {
|
|
return `
|
|
path "${mountPath}/${resource}" {
|
|
capabilities = ["read", "list"]
|
|
},
|
|
path "${mountPath}/${resource}/*" {
|
|
capabilities = ["read", "list"]
|
|
},
|
|
path "${mountPath}/${singularize(resource)}" {
|
|
capabilities = ["read", "list"]
|
|
},
|
|
path "${mountPath}/${singularize(resource)}/*" {
|
|
capabilities = ["read", "list"]
|
|
},
|
|
`;
|
|
};
|
|
export const updatePolicy = (mountPath, resource) => {
|
|
return `
|
|
path "${mountPath}/${resource}" {
|
|
capabilities = ["read", "list"]
|
|
},
|
|
path "${mountPath}/${resource}/*" {
|
|
capabilities = ["read", "update"]
|
|
},
|
|
path "${mountPath}/${singularize(resource)}/*" {
|
|
capabilities = ["read", "update"]
|
|
},
|
|
path "${mountPath}/issue/*" {
|
|
capabilities = ["update"]
|
|
},
|
|
path "${mountPath}/generate/*" {
|
|
capabilities = ["update"]
|
|
},
|
|
path "${mountPath}/import" {
|
|
capabilities = ["update"]
|
|
},
|
|
path "${mountPath}/sign/*" {
|
|
capabilities = ["update"]
|
|
},
|
|
`;
|
|
};
|