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

Add tests for checking partial table privileges on PG #40549

Merged
merged 2 commits into from
Mar 25, 2024

Conversation

qnkhuat
Copy link
Contributor

@qnkhuat qnkhuat commented Mar 25, 2024

Follow up from this request change I made in an external PR.

the test is quite similar to what I did in this fix for redshift

@qnkhuat qnkhuat requested a review from camsaul as a code owner March 25, 2024 08:30
@qnkhuat qnkhuat added the backport Automatically create PR on current release branch on merge label Mar 25, 2024
@metabase-bot metabase-bot bot added the .Team/BackendComponents also known as BEC label Mar 25, 2024
@@ -965,7 +965,7 @@
")"
"select t.*"
"from table_privileges t"]))
(filter #(or (:select %) (:update %) (:delete %) (:update %)))))
(filter #(or (:select %) (:update %) (:delete %) (:insert %)))))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

oopsie, caught a bug!

@qnkhuat qnkhuat requested a review from a team March 25, 2024 08:33
Copy link

replay-io bot commented Mar 25, 2024

Status Complete ↗︎
Commit d21cbec
Results
1 Failed
⚠️ 4 Flaky
2376 Passed

(is (= (into #{}
(map #(merge {:role nil
:schema "dotted.schema"
:table "dotted.materialized_view"
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rather exclude this default table name, could cause a lot of head scratching at test output if we forgot to override it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also nit, I think it'd be a little bit more obvious what's going on if you bound this map to something like base-privileges.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it'd be a little bit more obvious what's going on if you bound this map to something like base-privileges

I agree with that if we reuse this function elsewhere, but in this context I like that I could see the default value in a single map opreration

Copy link
Contributor

Choose a reason for hiding this comment

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

It took my eyes a second to realise what's going on - checking which way around the merge is happening, then inferring the purpose of the merge. It wasn't helped by the :table key in both though.

Oh one more nit is that you could use (set ...) instead of (into #{} ...).

Copy link
Contributor

@crisptrutski crisptrutski left a comment

Choose a reason for hiding this comment

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

LGTM

@qnkhuat qnkhuat enabled auto-merge (squash) March 25, 2024 09:50
@qnkhuat qnkhuat merged commit 9b941d8 into master Mar 25, 2024
105 of 106 checks passed
@qnkhuat qnkhuat deleted the follow-up-test-for-partial-perm-pg branch March 25, 2024 10:40
Copy link

@qnkhuat Did you forget to add a milestone to the issue for this PR? When and where should I add a milestone?

metabase-bot bot added a commit that referenced this pull request Mar 25, 2024
…40555)

* Add tests for checking partial table privileges on PG (#40549)

* Include postgresql tables that are visible through column grants instead of full table grants for simple questions (#40034)

Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>

---------

Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>
Co-authored-by: Eric Jensen <ericcj@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Automatically create PR on current release branch on merge .Team/BackendComponents also known as BEC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants