Skip to content

Dan set user #697

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

Merged
merged 2 commits into from
Jun 6, 2023
Merged

Dan set user #697

merged 2 commits into from
Jun 6, 2023

Conversation

chillenberger
Copy link
Contributor

In guards, get user from saved cookie rather than cluster owner. This ensures even if cluster is not chosen the user is known for rendering top nav.

@@ -46,17 +47,31 @@ impl<'r> FromRequest<'r> for Cluster {
None => -1,
};

let shared_state = match request.guard::<&State<Clusters>>().await {
let user_id: i64 = match cookies.get_private("user_id") {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
let user_id: i64 = match cookies.get_private("user_id") {
let user_id = match cookies.get_private("user_id") {

Copy link
Contributor

Choose a reason for hiding this comment

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

Also we are setting this object in our closed source code, you don't need to fetch the cookie here. The cookie won't provide enough user information once we start adding more, e.g. email.

Outcome::Success(pool) => pool,
_ => return Outcome::Forward(()),
};

let pool = shared_state.get(cluster_id);
let pool = clusters_shared_state.get(cluster_id);

let context = Context {
Copy link
Contributor

@levkk levkk Jun 6, 2023

Choose a reason for hiding this comment

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

Isn't Context an exported public struct of this app? If not, it should be, so we instantiate it and set it in our code.

@chillenberger chillenberger merged commit 429e41f into master Jun 6, 2023
@chillenberger chillenberger deleted the dan-set-user branch June 6, 2023 18:39
SilasMarvin pushed a commit that referenced this pull request Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy