Fix namespace resolution in restoresession editor options - #1139
Merged
Conversation
The repository list and the OpenShift uid-range lookup both read the namespace from /route/query/namespace only. That query param is absent on the /restoresessions/create route, so a namespace-scoped org (orgType 3) requested .../namespaces//repositories and the security context was never set. Resolve the namespace from the route query, then the release namespace in the model, then the single namespace granted by the access review, and refetch both when the namespace picker changes. Signed-off-by: Arnob Kumar Saha <arnob@appscode.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
getRepositoriesandsetSecurityContextboth read the namespace from/route/query/namespaceonly. That query param is absent on the/restoresessions/createroute, so:orgType === 3) the repository list requested.../namespaces//repositoriesand returned nothing;sa.scc.uid-rangelookup was silently skipped.The other two entry points (
/mongodbs/<db>/backup?namespace=and/operations/create-restoresession?namespace=) carry the param, which is why only the direct create route was broken.Both now resolve the namespace through
resolveNamespace(): route query →/metadata/release/namespacein the model → the single namespace granted by theSelfSubjectNamespaceAccessReview(fetchNamespacesApi, already cached ininit). The cluster-scoped repository list is unchanged for full-access orgs.create-ui.yaml: the Repository loader andsetSecurityContextnow watchmetadata/release/namespace, since in the console flowinitMetadataruns before the user picks a namespace.Snapshots needed no change —
getSnapshotsalready scopes to the selected repository's own namespace. Addons stay cluster-scoped (Addonisscope: Cluster).