open-consul/ui/packages/consul-ui/app/adapters/application.js
John Cowen dc183b1786
ui: Restrict the viewing/editing of certain UI elements based on the users ACLs (#9687)
This commit use the internal authorize endpoint along wiht ember-can to further restrict user access to certain UI features and navigational elements depending on the users ACL token
2021-02-19 16:42:16 +00:00

23 lines
532 B
JavaScript

import Adapter from './http';
import { inject as service } from '@ember/service';
export const DATACENTER_QUERY_PARAM = 'dc';
export const NSPACE_QUERY_PARAM = 'ns';
export default class ApplicationAdapter extends Adapter {
@service('client/http') client;
@service('env') env;
formatNspace(nspace) {
if (this.env.var('CONSUL_NSPACES_ENABLED')) {
return nspace !== '' ? { [NSPACE_QUERY_PARAM]: nspace } : undefined;
}
}
formatDatacenter(dc) {
return {
[DATACENTER_QUERY_PARAM]: dc,
};
}
}