Fixes from code overview session #5
2 changed files with 14 additions and 0 deletions
6
Makefile
6
Makefile
|
@ -1,4 +1,10 @@
|
|||
|
||||
check:
|
||||
cargo test
|
||||
cargo fmt --check
|
||||
cargo clippy
|
||||
cargo build --release
|
||||
|
||||
run:
|
||||
SECURE_SESSIONS=false RUST_LOG=debug cargo run -- --reload-templates
|
||||
|
||||
|
|
|
@ -42,6 +42,14 @@ pub mod q {
|
|||
};
|
||||
|
||||
if row_count > 0 {
|
||||
erika marked this conversation as resolved
|
||||
if row_count > 1 {
|
||||
tracing::error!(
|
||||
row_count = row_count,
|
||||
user_id = user_id,
|
||||
project_id = project_id,
|
||||
"unexpected row count: more than one project membership for this user"
|
||||
)
|
||||
}
|
||||
Ok(Decision::Allowed)
|
||||
} else {
|
||||
Ok(Decision::Denied)
|
||||
|
|
Loading…
Reference in a new issue
Do we have a scenario where
row_count
can be greater than 1?I don't think so. There's no constraint in the database to make it so that users are only members of a project once, but I can't imagine why we'd do that on purpose. It could be a good place to put an error log if the row count is over 1, while continuing to work.
I added an error log. Open to changing it, erring on the side of merging.