-
-
Notifications
You must be signed in to change notification settings - Fork 797
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
[legacy-framework] Add setPublicDataForUser()
— useful for updating the role of another user
#2473
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.
Thank you!!
There is one thing I might want to test with this, that is actually being logged in with both users and check what happens to the user, when his publiData is being updated. In my version of this function, which I posted in the linked issue, it worked, but when I changed browsers to quickly after updating the role, the user got weird invalid session and CSRF errors. Which is probably a bug in the session logic, but using this new API could trigger this. |
@lksnmnn ok good to know. You are going to test? |
Yes, I will try to reproduce this in the auth example, so I can debug and hopefully find the issue. From outside it “felt” similar to the issue I was having with using gSSP (https://github.com/blitz-js/blitz/issues/2448). But I wont be able to start this before Sunday I guess. |
I could not reproduce this bug in the auth example. So I guess the issue was my code doing something weird. 🚀 |
Ok thank you, we'll roll with this and address the bug later if it shows up |
setPublicDataForUser()
— useful for updating the role of another user
Added @lksnmnn contributions for code and test |
setPublicDataForUser()
— useful for updating the role of another usersetPublicDataForUser()
— useful for updating the role of another user
Closes: blitz-js/legacy-framework#144
Documentation PR: blitz-js/blitzjs.com#500
What are the changes and their implications?
This change adds a new API to update a user's
publicData
across all of the user's active sessions. Among other things this feature solves the common usecase, where a user's role is changed and the change should be reflected immediatly, i.e., when the user is denoted from "admin" to "user".Bug Checklist
Feature Checklist