mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-22 23:21:08 +02:00
* Request resultant-acl only from users root namespace * Update permissions adapter to always call resultant-acl at users root, with test * Update resultant-acl to accept failType * Update permissions service to set permissionsBanner based on resultant-acl contents * wire it up * add changelog * cleanup unused adapter changes * use getter for shared namespace logic
38 lines
1.0 KiB
JavaScript
38 lines
1.0 KiB
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import { module, test } from 'qunit';
|
|
import { setupTest } from 'ember-qunit';
|
|
import { setupMirage } from 'ember-cli-mirage/test-support';
|
|
|
|
module('Unit | Adapter | permissions', function (hooks) {
|
|
setupTest(hooks);
|
|
setupMirage(hooks);
|
|
|
|
test('it calls resultant-acl with the users root namespace', async function (assert) {
|
|
assert.expect(1);
|
|
const adapter = this.owner.lookup('adapter:permissions');
|
|
const nsService = this.owner.lookup('service:namespace');
|
|
nsService.setNamespace('admin/foo');
|
|
nsService.reopen({
|
|
userRootNamespace: 'admin/bar',
|
|
});
|
|
this.server.get('/sys/internal/ui/resultant-acl', (schema, request) => {
|
|
assert.strictEqual(
|
|
request.requestHeaders['X-Vault-Namespace'],
|
|
'admin/bar',
|
|
'Namespace is users root not current path'
|
|
);
|
|
return {
|
|
data: {
|
|
exact_paths: {},
|
|
glob_paths: {},
|
|
},
|
|
};
|
|
});
|
|
await adapter.query();
|
|
});
|
|
});
|