mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-30 18:17:55 +00:00
UI: Correctly call resultant-acl endpoint when user root is root (#25766)
* Correctly call resultant-acl endpoint when user root is root * check test differently * Add changelog
This commit is contained in:
3
changelog/25766.txt
Normal file
3
changelog/25766.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
```release-note:bug
|
||||||
|
ui: call resultant-acl without namespace header when user mounted at root namespace
|
||||||
|
```
|
||||||
@@ -7,7 +7,7 @@ import ApplicationAdapter from './application';
|
|||||||
|
|
||||||
export default ApplicationAdapter.extend({
|
export default ApplicationAdapter.extend({
|
||||||
query() {
|
query() {
|
||||||
const namespace = this.namespaceService.userRootNamespace || this.namespaceService.path;
|
const namespace = this.namespaceService.userRootNamespace ?? this.namespaceService.path;
|
||||||
return this.ajax(this.urlForQuery(), 'GET', { namespace });
|
return this.ajax(this.urlForQuery(), 'GET', { namespace });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -36,4 +36,29 @@ module('Unit | Adapter | permissions', function (hooks) {
|
|||||||
});
|
});
|
||||||
await adapter.query();
|
await adapter.query();
|
||||||
});
|
});
|
||||||
|
test('it calls resultant-acl with the users root namespace when root', async function (assert) {
|
||||||
|
assert.expect(1);
|
||||||
|
const adapter = this.owner.lookup('adapter:permissions');
|
||||||
|
const nsService = this.owner.lookup('service:namespace');
|
||||||
|
const auth = this.owner.lookup('service:auth');
|
||||||
|
nsService.setNamespace('admin');
|
||||||
|
auth.setCluster('1');
|
||||||
|
auth.set('tokens', ['vault-_root_☃1']);
|
||||||
|
auth.setTokenData('vault-_root_☃1', { userRootNamespace: '', backend: { mountPath: 'token' } });
|
||||||
|
|
||||||
|
this.server.get('/sys/internal/ui/resultant-acl', (schema, request) => {
|
||||||
|
assert.false(
|
||||||
|
Object.keys(request.requestHeaders).includes('X-Vault-Namespace'),
|
||||||
|
'request is called without namespace'
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
data: {
|
||||||
|
exact_paths: {},
|
||||||
|
glob_paths: {},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
await adapter.query();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user