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 1881386: hide Import with Wizard button when missing permissions #6725

Merged
merged 1 commit into from Sep 25, 2020

Conversation

atiratree
Copy link
Member

No description provided.

@openshift-ci-robot openshift-ci-robot added bugzilla/severity-high Referenced Bugzilla bug's severity is high 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. labels Sep 23, 2020
@openshift-ci-robot
Copy link
Contributor

@suomiy: This pull request references Bugzilla bug 1881386, 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.6.0) matches configured target release for branch (4.6.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1881386: hide Import with Wizard button when missing permissions

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-robot openshift-ci-robot added the component/kubevirt Related to kubevirt-plugin label Sep 23, 2020
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 23, 2020
})
.then((result: SelfSubjectAccessReviewKind) => {
if (result?.status?.allowed) {
setImportAllowed(result?.status?.allowed);
Copy link
Member

Choose a reason for hiding this comment

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

can you replace result?.status?.allowed with true ?
we don't really using the result here, for example we can't set it to false in case the result is false

Copy link
Member Author

Choose a reason for hiding this comment

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

it would be keeping the origin of that value. Nevertheless it doesn't really matter - changed to true

setImportAllowed(result?.status?.allowed);
}
})
.catch(() => setImportAllowed(true));
Copy link
Member

Choose a reason for hiding this comment

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

why do we return true on fail, what am I missing ?

Copy link
Member Author

Choose a reason for hiding this comment

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

this is the default behaviour of rbac in console. If you fail checking permisions for something, then do it and fail/succeed a bit later

Copy link
Member

Choose a reason for hiding this comment

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

can you point to an example ?

I found 2 places where we default to false and did not not find places where we default to true
[1]

.catch(() => dispatch({ type: Action.setHasAccessToPullImage, value: false })),

[2]

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

a - if you decide we should use this use case, you should also add the comment explaining the odd behaviour:
https://github.com/openshift/console/blob/master/frontend/public/components/utils/rbac.tsx#L114
b - this is not the default behaviour, useAccessReview2 is used far less then useAccessReview that defaults to false
https://github.com/openshift/console/blob/master/frontend/public/components/utils/rbac.tsx#L127

Copy link
Member Author

Choose a reason for hiding this comment

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

useAccessReview uses useAccessReview2 under the hood, so it has the same behaviour and defaults to true

ok, copied the explanation there

@yaacov
Copy link
Member

yaacov commented Sep 24, 2020

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 24, 2020
@yaacov
Copy link
Member

yaacov commented Sep 24, 2020

/hold

we need a comment to explain why we default to allow access when access check is failing (or default to dissallow)

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 24, 2020
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Sep 24, 2020
@yaacov
Copy link
Member

yaacov commented Sep 24, 2020

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 24, 2020
@yaacov
Copy link
Member

yaacov commented Sep 24, 2020

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 24, 2020
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: suomiy, yaacov

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

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

1 similar comment
@openshift-bot
Copy link
Contributor

/retest

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

@atiratree
Copy link
Member Author

/retest

@openshift-merge-robot openshift-merge-robot merged commit 5f07af4 into openshift:master Sep 25, 2020
@openshift-ci-robot
Copy link
Contributor

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

Bugzilla bug 1881386 has been moved to the MODIFIED state.

In response to this:

Bug 1881386: hide Import with Wizard button when missing permissions

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.

@spadgett spadgett added this to the v4.6 milestone Sep 28, 2020
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-high Referenced Bugzilla bug's severity is high 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/kubevirt Related to kubevirt-plugin lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants