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

fix(session): CURRENT ROLE behavior with AUTH ROLE is set #8546

Merged
merged 5 commits into from
Oct 31, 2022

Conversation

flaneur2020
Copy link
Member

@flaneur2020 flaneur2020 commented Oct 31, 2022

I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/

Summary

The behaviour about CURRENT ROLE with auth_role is broken, as the auth_role is set as "account_admin", but SELECT current_role() still gets "public".

The expected behaviour is that when the AUTH ROLE is set, it defaults as the CURRENT ROLE, except when X-DATABEND-ROLE is set (which must be one of the AUTH ROLE's children roles).

This PR also made a minor refactor: replace session.set_current_user to session.set_authed_user which plays as an unified entrypoint on authentication success. So instead of manage logics in different handlers, we can collect the works on authenticated success into this method.

@vercel
Copy link

vercel bot commented Oct 31, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated
databend ⬜️ Ignored (Inspect) Oct 31, 2022 at 8:36AM (UTC)

@mergify mergify bot added the pr-bugfix this PR patches a bug in codebase label Oct 31, 2022
@flaneur2020 flaneur2020 force-pushed the fix-current-role-by-auth-role branch 2 times, most recently from f0317af to d13a05d Compare October 31, 2022 06:36
@Xuanwo Xuanwo changed the title fix(session): CURRENT ROLE behaviour with AUTH ROLE is set fix(session): CURRENT ROLE behavior with AUTH ROLE is set Oct 31, 2022
@flaneur2020 flaneur2020 force-pushed the fix-current-role-by-auth-role branch from d13a05d to 7fa6f50 Compare October 31, 2022 06:40
@flaneur2020 flaneur2020 force-pushed the fix-current-role-by-auth-role branch from 7fa6f50 to 69adecc Compare October 31, 2022 06:47
@flaneur2020 flaneur2020 force-pushed the fix-current-role-by-auth-role branch from 08e0158 to 8650a75 Compare October 31, 2022 08:36
@flaneur2020 flaneur2020 marked this pull request as ready for review October 31, 2022 09:16
@BohuTANG BohuTANG merged commit 8c45e8e into databendlabs:main Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-bugfix this PR patches a bug in codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants