ui: Temporarily force all UI capabilities (#11520)

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
This commit is contained in:
John Cowen 2021-11-10 11:05:27 +00:00 committed by GitHub
parent eb2b40b22d
commit a34f81cc29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

4
.changelog/11520.txt Normal file
View File

@ -0,0 +1,4 @@
```release-note:bug
ui: Revert to depending on the backend, 'post-user-action', to report
permissions errors rather than using UI capabilities 'pre-user-action'
```

View File

@ -148,6 +148,18 @@ export default class PermissionService extends RepositoryService {
async findAll(params) {
params.resources = REQUIRED_PERMISSIONS;
this.permissions = await this.findByPermissions(params);
/**/
// 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
this.permissions.forEach(item => {
if(['key', 'node', 'service', 'intentions', 'session'].includes(item.Resource)) {
item.Allow = true;
}
})
/**/
return this.permissions;
}
}