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: hide reset options for non-admins #95303

Merged
merged 1 commit into from
Jan 17, 2023
Merged

Conversation

maryliag
Copy link
Contributor

Previously, we were showing reset sql stats and reset index stats options for all users. If a non-admin user tried to reset, it wasn't doing the reset as expected, but no message was being displayed.
This commit now hides these options for non-admin so it's no longer confusing to see the options but not being able to use it.

Fixes #95213

https://www.loom.com/share/d82672e9ec994a6e9200fd9094ee9b55

Release note (ui change): Remove reset sql stats and reset index stats from the Console when the user is a non-admin.

@maryliag maryliag requested review from a team January 16, 2023 16:08
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link

@THardy98 THardy98 left a comment

Choose a reason for hiding this comment

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

:lgtm:

Just a quick note about the default config props on the statements page

Reviewed 15 of 15 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @maryliag)


pkg/ui/workspaces/cluster-ui/src/statementsPage/statementsPage.tsx line 220 at r1 (raw file):

    isTenant: false,
    hasViewActivityRedactedRole: false,
    hasAdminRole: false,

Do we need these default props when they're already stored as part of the UIConfigState ?

Copy link
Contributor Author

@maryliag maryliag left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @THardy98)


pkg/ui/workspaces/cluster-ui/src/statementsPage/statementsPage.tsx line 220 at r1 (raw file):

Previously, THardy98 (Thomas Hardy) wrote…

Do we need these default props when they're already stored as part of the UIConfigState ?

good point, we're not using this, so I remove here and in a few other places.

Previously, we were showing reset sql stats and reset
index stats options for all users. If a non-admin user tried
to reset, it wasn't doing the reset as expected, but no
message was being displayed.
This commit now hides these options for non-admin so it's
no longer confusing to see the options but not being
able to use it.

Fixes cockroachdb#95213

Release note (ui change): Remove `reset sql stats` and `reset index stats`
from the Console when the user is a non-admin.
@maryliag
Copy link
Contributor Author

TFTR!
bors r+

@craig
Copy link
Contributor

craig bot commented Jan 17, 2023

Build succeeded:

@craig craig bot merged commit 43cd78e into cockroachdb:master Jan 17, 2023
@blathers-crl
Copy link

blathers-crl bot commented Jan 17, 2023

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error creating merge commit from 2884bb0 to blathers/backport-release-22.2-95303: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 22.2.x failed. See errors above.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

@maryliag maryliag deleted the admin-checks branch January 17, 2023 00:52
maryliag added a commit to maryliag/cockroach that referenced this pull request Jan 18, 2023
Continuation from cockroachdb#95303

The previous PR missed the reset on the Transactions tab.
This PR removes the reset sql stats for non-admin users.

Fixes cockroachdb#95213

Release note (ui change): Remove `reset sql stats` from Transactions
page for non-admins.
craig bot pushed a commit that referenced this pull request Jan 19, 2023
95461: ui: remove reset sql stats for non-admin r=maryliag a=maryliag

Continuation from #95303

The previous PR missed the reset on the Transactions tab. This PR removes the reset sql stats for non-admin users.

Fixes #95213

Release note (ui change): Remove `reset sql stats` from Transactions page for non-admins.

95466: ingesting: fixup privileges granted during database restore r=rafiss a=adityamaru

Previously, all schemas and tables that were ingested as part of a database restore would "inherit" the privileges of the database. The database would be granted `CONNECT` for the `public` role and `ALL` to `admin` and `root`, and so all ingested schemas would have `ALL` for `admin` and `root`. Since 21.2 we have moved away from tables/schemas inheriting privileges from the parent database and so this logic is stale and partly incorrect. It is incorrect because the restored `public` schema does not have `CREATE` and `USAGE` granted to the `public` role. These privileges are always granted to `public` schemas of a database and so there is a discrepancy in restore's behaviour.

This change simplifies the logic to grant schemas and tables their default set of privileges if ingested via a database restore. It leaves the logic for cluster and table restores unchanged.

Release note (bug fix): fixes a bug where a database restore would not grant `CREATE` and `USAGE` on the public schema to the public role

Fixes: #95456

95467: schemachanger: a bunch of small fixes r=postamar a=postamar

Informs #88294.

Release note: None

95504: schemachangerccl: rename generated tests r=postamar a=postamar

This commit adds an underscore in the generated tests' name where there previously was one missing.

Informs #88294.

Release note: None

95512: kvserver: fix flaky TestLearnerReplicateQueueRace test r=tbg a=aliher1911

Test was not expecting raft snapshots and injected failure at wrong moments.

Fixes #94993

Release note: None

Co-authored-by: maryliag <[email protected]>
Co-authored-by: adityamaru <[email protected]>
Co-authored-by: Marius Posta <[email protected]>
Co-authored-by: Oleg Afanasyev <[email protected]>
maryliag added a commit to maryliag/cockroach that referenced this pull request Jan 19, 2023
Continuation from cockroachdb#95303

The previous PR missed the reset on the Transactions tab.
This PR removes the reset sql stats for non-admin users.

Fixes cockroachdb#95213

Release note (ui change): Remove `reset sql stats` from Transactions
page for non-admins.
maryliag added a commit to maryliag/cockroach that referenced this pull request Jan 19, 2023
Continuation from cockroachdb#95303

The previous PR missed the reset on the Transactions tab.
This PR removes the reset sql stats for non-admin users.

Fixes cockroachdb#95213

Release note (ui change): Remove `reset sql stats` from Transactions
page for non-admins.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DBConsole SQL Activity shows 'reset SQL stats' for unprivileged users
3 participants