2023-03-14 13:18:55 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
2023-08-11 13:12:13 +00:00
|
|
|
* SPDX-License-Identifier: BUSL-1.1
|
2023-03-14 13:18:55 +00:00
|
|
|
*/
|
|
|
|
|
2021-02-19 16:42:16 +00:00
|
|
|
import BaseAbility, { ACCESS_LIST } from './base';
|
|
|
|
|
|
|
|
export default class KVAbility extends BaseAbility {
|
|
|
|
resource = 'key';
|
|
|
|
|
|
|
|
generateForSegment(segment) {
|
|
|
|
let resources = super.generateForSegment(segment);
|
|
|
|
if (segment.endsWith('/')) {
|
|
|
|
resources = resources.concat(this.permissions.generate(this.resource, ACCESS_LIST, segment));
|
|
|
|
}
|
|
|
|
return resources;
|
|
|
|
}
|
2022-01-07 19:26:54 +00:00
|
|
|
/**/
|
|
|
|
// Temporarily revert to pre-1.10 UI functionality by overwriting frontend
|
|
|
|
// permissions. These are used to hide certain UI elements, but they are
|
|
|
|
// still enforced on the backend.
|
|
|
|
// This temporary measure should be removed again once https://github.com/hashicorp/consul/issues/11098
|
|
|
|
// has been resolved
|
2021-09-22 17:23:59 +00:00
|
|
|
get canRead() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
get canList() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
get canWrite() {
|
|
|
|
return true;
|
|
|
|
}
|
2022-01-07 19:26:54 +00:00
|
|
|
/**/
|
2021-02-19 16:42:16 +00:00
|
|
|
}
|