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

Bug 2018234: Fix that user settings ConfigMap is also created for users with restricted access #10705

Merged

Conversation

christoph-jerolimov
Copy link
Member

@christoph-jerolimov christoph-jerolimov commented Dec 20, 2021

Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=2018234

Analysis / Root cause:
In #9153 we changed the implementation to save the user settings automatically to the browser localStorage instead of ConfigMap when the watcher returns a 404 Not Found. Previously this check was done after the createConfigMap call and checks for 403 Forbidden and 404 Not Found.

The fetch call and watcher returns only 404 Not Found for kubeadmins or other cluster users with access to the openshift-console-user-settings namespace. But for users with restricted access, these API calls return a 403 Forbidden instead.

Previously the createConfigMap endpoint (POST /api/console/user-settings) was never called:

49-user

Solution Description:
We need to call createConfigMap also if the API returns 403 Forbidden.

Open the console the first time as kubeadmin:

patched-kubeadmin

Open the console the first time as restricted user:

patch-user

Screen shots / Gifs for design review:
No UI change

Unit test coverage report:
Added / updated some tests

Test setup:

  1. Open your browser network inspector and filter for "settings".
  2. Open ODC with kubeadmin
  3. Open ODC with the restricted user. ⚠️ The user must not see other projects, and esp. not the openshift-console-user-settings namespace.

User settings should be created when opening the console the first time and updated/saved after that in the ConfigMap.

Browser conformance:

  • Chrome
  • Firefox
  • Safari
  • Edge

@openshift-ci openshift-ci bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. labels Dec 20, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 20, 2021

@jerolimov: This pull request references Bugzilla bug 2018234, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.10.0) matches configured target release for branch (4.10.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

Requesting review from QA contact:
/cc @sanketpathak

In response to this:

[WIP] Bug 2018234: Fix user settings for normal users

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci openshift-ci bot added the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label Dec 20, 2021
@openshift-ci openshift-ci bot added component/shared Related to console-shared approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Dec 20, 2021
@christoph-jerolimov christoph-jerolimov changed the title [WIP] Bug 2018234: Fix user settings for normal users [WIP] Bug 2018234: Fix that user settings are saved for normal users again Dec 20, 2021
@christoph-jerolimov christoph-jerolimov force-pushed the fix-usersettings branch 2 times, most recently from 11b9055 to 4aaf47e Compare December 21, 2021 10:14
@christoph-jerolimov christoph-jerolimov changed the title [WIP] Bug 2018234: Fix that user settings are saved for normal users again Bug 2018234: Fix that user settings ConfigMap is also created for users with restricted access Dec 21, 2021
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 21, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 21, 2021

@jerolimov: This pull request references Bugzilla bug 2018234, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.10.0) matches configured target release for branch (4.10.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

Requesting review from QA contact:
/cc @sanketpathak

In response to this:

Bug 2018234: Fix that user settings ConfigMap is also created for users with restricted access

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

1 similar comment
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 21, 2021

@jerolimov: This pull request references Bugzilla bug 2018234, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.10.0) matches configured target release for branch (4.10.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

Requesting review from QA contact:
/cc @sanketpathak

In response to this:

Bug 2018234: Fix that user settings ConfigMap is also created for users with restricted access

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@christoph-jerolimov
Copy link
Member Author

/cc @invincibleJai @sahil143
Can one of you please take a look? Thanks

@christoph-jerolimov
Copy link
Member Author

/retest

@christoph-jerolimov
Copy link
Member Author

/retest

Copy link
Contributor

@sahil143 sahil143 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

verified locally works as expected.

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 6, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 6, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jerolimov, sahil143

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

2 similar comments
@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

5 similar comments
@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 7, 2022

@jerolimov: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-merge-robot openshift-merge-robot merged commit 7ca26cc into openshift:master Jan 7, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 7, 2022

@jerolimov: All pull requests linked via external trackers have merged:

Bugzilla bug 2018234 has been moved to the MODIFIED state.

In response to this:

Bug 2018234: Fix that user settings ConfigMap is also created for users with restricted access

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@christoph-jerolimov
Copy link
Member Author

/cherry-pick release-4.9

@openshift-cherrypick-robot

@jerolimov: #10705 failed to apply on top of branch "release-4.9":

Applying: Fix that user settings ConfigMap is also created for users with restricted access
Using index info to reconstruct a base tree...
M	frontend/packages/console-shared/src/hooks/__tests__/useUserSettings.spec.ts
M	frontend/packages/console-shared/src/hooks/useUserSettings.ts
Falling back to patching base and 3-way merge...
Auto-merging frontend/packages/console-shared/src/hooks/useUserSettings.ts
CONFLICT (content): Merge conflict in frontend/packages/console-shared/src/hooks/useUserSettings.ts
Auto-merging frontend/packages/console-shared/src/hooks/__tests__/useUserSettings.spec.ts
CONFLICT (content): Merge conflict in frontend/packages/console-shared/src/hooks/__tests__/useUserSettings.spec.ts
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Fix that user settings ConfigMap is also created for users with restricted access
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-4.9

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. component/shared Related to console-shared lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants