mirror of
https://github.com/kemko/nomad.git
synced 2026-01-07 10:55:42 +03:00
ui: fix ability checking when anon policy is missing namespace (#14144)
ACL Policies aren't required to have any `namespace` blocks, and this is particularly common with the anonymous policy. If a user visits the web UI without a token already in their local storage and the anonymous policy has no `namespace` blocks, the UI will hit unhandled exceptions when rendering the sidebar or jobs page. Filter for the case where there's no `namespace` block.
This commit is contained in:
@@ -31,6 +31,7 @@ export default class Job extends AbstractAbility {
|
||||
// For each policy record, extract all policies of all namespaces
|
||||
const allNamespacePolicies = policies
|
||||
.toArray()
|
||||
.filter((policy) => get(policy, 'rulesJSON.Namespaces'))
|
||||
.map((policy) => get(policy, 'rulesJSON.Namespaces'))
|
||||
.flat()
|
||||
.map((namespace = {}) => {
|
||||
|
||||
@@ -81,6 +81,7 @@ export default class Variable extends AbstractAbility {
|
||||
) {
|
||||
const namespacesWithSecureVariableCapabilities = policies
|
||||
.toArray()
|
||||
.filter((policy) => get(policy, 'rulesJSON.Namespaces'))
|
||||
.map((policy) => get(policy, 'rulesJSON.Namespaces'))
|
||||
.flat()
|
||||
.map((namespace = {}) => {
|
||||
|
||||
Reference in New Issue
Block a user