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 email user property #899

Merged
merged 4 commits into from
Jul 12, 2023
Merged

Conversation

geichelberger
Copy link
Contributor

This PR adds an optional user email property; this is useful if Tobira creates the user reference in Opencast via JWT.

There is a bug if the email column contains a null value; I wonder if I made a mistake or if the macro/FieldIndex does not support null values from the database.

thread 'tokio-runtime-worker' panicked at 'error retrieving column 3: error deserializing column 3: a Postgres value was `NULL`', /xyz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-postgres-0.7.8/src/row.rs:151:25
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: tokio_postgres::row::Row::get
             at /xyz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-postgres-0.7.8/src/row.rs:151:25
   3: tobira::db::util::FieldIndex::of
             at ./src/db/util.rs:150:9
   4: tobira::auth::User::from_session::{{closure}}
             at ./src/auth/mod.rs:268:20
   5: tobira::auth::User::new::{{closure}}
             at ./src/auth/mod.rs:204:21

This allows Tobira to handle a user's email address.
It is crucial when Tobira creates a user reference in Opencast via JWT login.
Copy link
Member

@LukasKalbertodt LukasKalbertodt left a comment

Choose a reason for hiding this comment

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

Thanks for the thorough PR! You had to touch a lot of files and I don't think you missed anything :D

I still don't understand the motivation behind the PR, though. You said "user reference in Opencast via JWT" but... what does that mean? Why is an email address useful in that case? Can you elaborate?

backend/src/auth/mod.rs Outdated Show resolved Hide resolved
backend/src/auth/mod.rs Outdated Show resolved Hide resolved
backend/src/db/migrations/22-user-email.sql Outdated Show resolved Hide resolved
docs/docs/setup/auth/jwt.md Show resolved Hide resolved
util/authkit/src/index.ts Outdated Show resolved Hide resolved
util/authkit/src/index.ts Outdated Show resolved Hide resolved
util/dummy-login/index.ts Outdated Show resolved Hide resolved
@geichelberger
Copy link
Contributor Author

I still don't understand the motivation behind the PR, though. You said "user reference in Opencast via JWT" but... what does that mean? Why is an email address useful in that case? Can you elaborate?

In our setup, if the user gets in touch with our system for the first time via Tobira, the user reference is created with the data from Tobiras JWT Token, and because it does not contain the email address, a dummy one is built like in the docs example.

With a valid email address, sending emails via workflows is possible, and I like consistent data ;).

Seems related to #672

@LukasKalbertodt
Copy link
Member

Yeah that makes sense! With my inline comments fixed, this PR can be merged!

@geichelberger
Copy link
Contributor Author

I removed the email from the user jose for easier testing.

Copy link
Member

@LukasKalbertodt LukasKalbertodt left a comment

Choose a reason for hiding this comment

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

Just one tiny thing!

backend/src/api/model/user.rs Outdated Show resolved Hide resolved
Copy link
Member

@LukasKalbertodt LukasKalbertodt left a comment

Choose a reason for hiding this comment

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

Thanks a lot!

@LukasKalbertodt LukasKalbertodt merged commit cafba46 into elan-ev:master Jul 12, 2023
5 checks passed
@LukasKalbertodt LukasKalbertodt added the changelog:admin Changes primarily for admins label Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:admin Changes primarily for admins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants