Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui: [BUGFIX] Ensure we use the ns query param name when requesting permissions #10608

Merged
merged 3 commits into from
Jul 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/10608.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
ui: **(Enterprise only)** Ensure permissions are checked based on the actively selected namespace
```
2 changes: 1 addition & 1 deletion ui/packages/consul-ui/app/adapters/permission.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default class PermissionAdapter extends Adapter {
requestForAuthorize(request, { dc, ns, resources = [], index }) {
// the authorize endpoint is slightly different to all others in that it
// ignores an ns parameter, but accepts a Namespace property on each
// resource. Here we hide this different from the rest of the app as
// resource. Here we hide this difference from the rest of the app as
// currently we never need to ask for permissions/resources for multiple
// different namespaces in one call so here we use the ns param and add
// this to the resources instead of passing through on the queryParameter
Expand Down
2 changes: 1 addition & 1 deletion ui/packages/consul-ui/app/routes/dc.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default class DcRoute extends Route {
// When disabled nspaces is [], so nspace is undefined
const permissions = await this.permissionsRepo.findAll({
dc: params.dc,
nspace: get(nspace || {}, 'Name'),
ns: get(nspace || {}, 'Name'),
});
// the model here is actually required for the entire application
// but we need to wait until we are in this route so we know what the dc
Expand Down
2 changes: 1 addition & 1 deletion ui/packages/consul-ui/app/routes/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default class SettingsRoute extends Route {
typeof app.permissions === 'undefined'
? await this.permissionsRepo.findAll({
dc: dc.Name,
nspace: nspace.Name,
ns: nspace.Name,
})
: app.permissions;

Expand Down