-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
server: fix UserSQLRoles to account for global privileges #95258
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Can you also add a test on
cockroach/pkg/server/user_test.go
Line 77 in b8eee78
func TestSQLRolesAPI(t *testing.T) { |
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @kpatron-cockroachlabs)
0daec0b
to
849f846
Compare
@maryliag can you point me to where this endpoint is used in the frontend? i'm wondering since my change reduces the set of privileges that are returned in the map. e.g., it no longer includes cockroach/pkg/sql/privilege/privilege.go Line 129 in 0e835dd
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically we call refreshUser like this,
which then updates our redux layer, then we can use selectors to got some of the specific roles we care about, for now we only care about roles VIEWACTIVITYREDACTED
and ADMIN
,
which then can be used in places like here and here (this example is hiding statement diagnostics if the user has VIEWACTIVITYROLE
)
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @kpatron-cockroachlabs and @rafiss)
pkg/server/user_test.go
line 114 at r2 (raw file):
require.Equal(t, expRoles, res.Roles) // Remove one role from non-admin user.
can you also add an example with revoke global privilege?
Release note (bug fix): DB Console features that check for the VIEWACTIVITYREDACTED privilege now also account for global privileges.
849f846
to
2a33966
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i see, thanks for explaining! RFAL
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @kpatron-cockroachlabs and @maryliag)
pkg/server/user_test.go
line 114 at r2 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
can you also add an example with revoke global privilege?
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 2 files at r2, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @kpatron-cockroachlabs)
tftr! flake was #95140 which was resolved in a later PR bors r=maryliag |
Build succeeded: |
Epic: None
Release note (bug fix): DB Console features that check for the
VIEWACTIVITYREDACTED privilege now also account for global privileges.