-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Use role-based permissions for source-postgres #11938
Conversation
|
Thanks for the contribution @radostyle, can you sign the CLA? |
Waiting user to sign the CLA. @radostyle ping |
Modify permissions query to add recursive lookup of role-based permissions. This solves problems users are having with not being able to list tables for postgres souces
I just signed it, but it is not showing signed on the ticket.
…On Tue, Apr 19, 2022, 1:40 PM Marcos Marx ***@***.***> wrote:
Waiting user to sign the CLA. @radostyle <https://github.com/radostyle>
ping
—
Reply to this email directly, view it on GitHub
<#11938 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABFCZIJYMB6VIW54LSNEELVF34X7ANCNFSM5TIEVMTQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
There was an issue with the email used for the commit, but I fixed it. It is showing signed now. |
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.
Thank you for the contribution!
Would you mind adding some unit tests? One example is testUserDoesntHasPrivilegesToSelectTable
in PostgresSourceTest.java
. Ideally the tests should verify that:
- When the user has SELECT privilege on a table,
getPrivilegesTableForCurrentUser
will include that that table in the returned result. - When the user has no SELECT privilege on a table, that table won't be included in the return result.
It's also fine though if you don't have bandwidth to work on the unit test.
I included a unit test that tests the discovery logic. |
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.
Confirmed that this PR fixed the bug. Thanks a lot!
I will merge and publish a new version in a separate PR.
/test connector=connectors/source-postgres
|
/test connector=connectors/source-postgres-strict-encrypt
|
* Use role-based permissions for source-postgres Modify permissions query to add recursive lookup of role-based permissions. This solves problems users are having with not being able to list tables for postgres souces * Add unit test of discovery logic
Modify permissions query to add recursive lookup of role-based
permissions. This solves problems users are having with not being able
to list tables for postgres souces.
Fixes #10649
What
This solves problems users are having with not being able to list tables using the source-postgres connector.
The current implementation requires tables to be granted individually to a user.
Using roles is often a better way to manage permissions in postgres and should be supported.
This patch adds support for determining the tables a user has access to based on his role.
How
The accessible table are currently determined using a postgres query over the roles tables. This patch adds one more UNION condition to the existing query with a recursive role based query so that the roles work as expected by users.
Recommended reading order
airbyte-integrations/connectors/source-postgres/src/main/java/io/airbyte/integrations/source/postgres/PostgresSource.java
🚨 User Impact 🚨
When the user has created a postgres source and any target. The user then goes to create the connection. When listing the tables to sync under the
Replication
tab.Pre-merge Checklist
Expand the relevant checklist and delete the others.
New Connector
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
bootstrap.md
. See description and examplesdocs/SUMMARY.md
docs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampledocs/integrations/README.md
airbyte-integrations/builds.md
Airbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing/publish
command described hereUpdating a connector
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
bootstrap.md
. See description and examplesdocs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampleAirbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing/publish
command described hereConnector Generator
-scaffold
in their name) have been updated with the latest scaffold by running./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates
then checking in your changesTests
Unit
Put your unit tests output here.
Integration
Put your integration tests output here.
Acceptance
Put your acceptance tests output here.